Skip to content

Create better plans for NULL comparisons#6133

Merged
harshit-gangal merged 4 commits intovitessio:masterfrom
planetscale:null-planning
Apr 30, 2020
Merged

Create better plans for NULL comparisons#6133
harshit-gangal merged 4 commits intovitessio:masterfrom
planetscale:null-planning

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Apr 30, 2020

When building a VTgate query plan, if we are dealing with a comparison against a literal NULL value, previously we were just giving up and falling back on a scatter.

This change adds a new route opcode for queries that are known to never return values (SelectNone), which will be used when an equality with null is found in the list of predicates in the WHERE clause. It also handles IS NULL with a SelectEqual[Unique] when the vindex supports null values.

Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay requested a review from sougou as a code owner April 30, 2020 08:35
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay changed the title Create better plan for id = null Create better plan for NULL comparisons Apr 30, 2020
@systay systay requested a review from harshit-gangal April 30, 2020 08:54
@systay systay changed the title Create better plan for NULL comparisons Create better plans for NULL comparisons Apr 30, 2020
Copy link
Copy Markdown
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to have an endtoend test for it.

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal merged commit 3b64e30 into vitessio:master Apr 30, 2020
@harshit-gangal harshit-gangal deleted the null-planning branch April 30, 2020 14:19
@deepthi
Copy link
Copy Markdown
Collaborator

deepthi commented Apr 30, 2020

nit: it will be nice to document the problem in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants