Skip to content

Solve I_S queries using CNF rewriting#7677

Merged
systay merged 8 commits intovitessio:masterfrom
planetscale:cnf-rewriter
Mar 21, 2021
Merged

Solve I_S queries using CNF rewriting#7677
systay merged 8 commits intovitessio:masterfrom
planetscale:cnf-rewriter

Conversation

@systay
Copy link
Collaborator

@systay systay commented Mar 13, 2021

Description

To handle I_S queries correctly, we need to be able to find the table_schema and table_name predicates in the WHERE clause. Sometimes, this is difficult because of how the query is written.

What this PR does is to introduce a rewriter that is able to massage boolean logic into a simpler form. It normalises the predicates into a form that the planner is looking for, and this makes it possible for the planner to find more applicable rules.

CNF, short for conjuctive normal form, rewrites the predicates into an AND of ORs, which is exactly what the planner is looking for.

Related Issue(s)

Fixes: #7377

Checklist

  • Should this PR be backported? Nope
  • Tests were added or are not required Added
  • Documentation was added or is not required Not needed

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving

GuptaManan100 and others added 2 commits March 10, 2021 16:56
Signed-off-by: GuptaManan100 <manan@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay
Copy link
Collaborator Author

systay commented Mar 15, 2021

@pontusmelke am I doing it right? ;)

systay added 2 commits March 15, 2021 14:21
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay changed the title CNF rewriter Solve I_S queries using CNF rewriting Mar 15, 2021
@systay systay marked this pull request as ready for review March 15, 2021 14:32
@systay
Copy link
Collaborator Author

systay commented Mar 15, 2021

We could use this strategy in more situations - we could replan when we encounter Scatter queries, vtgate joins and probably some more.

Signed-off-by: Andres Taylor <andres@planetscale.com>
systay added 2 commits March 18, 2021 15:55
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay merged commit 33bf918 into vitessio:master Mar 21, 2021
@systay systay deleted the cnf-rewriter branch March 21, 2021 16:25
@pontusmelke
Copy link

@pontusmelke am I doing it right? ;)

Still got it 💥

@askdba askdba added this to the v10.0 milestone Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error 1105 "unsupported: cross-shard left join and where clause" querying information_schema on single-shard cluster

5 participants