Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform record fetches after union/intersection operators where possible #991

Closed
jleach4 opened this issue Jul 14, 2020 · 0 comments
Closed
Labels
enhancement New feature or request planner Related to the query planner

Comments

@jleach4
Copy link
Contributor

jleach4 commented Jul 14, 2020

Generated plans do not minimize the number of expensive index lookups.

Union Optimization

  •                              Starting Plan
    
  •                                  UnionPlan
    
  •                                   /              \
    
  •                                 /                \
    
  • RecordQueryPlan (IndexFetch) RecordQueryPlan (IndexFetch)
  •                                      |
    
  •                                      |
    
  •                                      V
    
  •                              Transformed Plan
    
  •                              UnionPlan (IndexFetch)
    
  •                              /              \
    
  •                             /                \
    
  •            RecordQueryPlan   RecordQueryPlan
    

Intersection Optimization

  •                              Starting Plan
    
  •                              IntersectionPlan
    
  •                              /              \
    
  •                             /                \
    
  •             RecordQueryPlan (IndexFetch) RecordQueryPlan (IndexFetch)
    
  •                                      |
    
  •                                      |
    
  •                                      V
    
  •                              Transformed Plan
    
  •                              IntersectionPlan (IndexFetch)
    
  •                              /              \
    
  •                             /                \
    
  •                     RecordQueryPlan   RecordQueryPlan
    

UnorderdPrimaryKeyDistinct

  •                           UnorderedPrimaryKeyDistinct
    
  •                                      |
    
  •                                      |
    
  •                         RecordQueryPlanWithIndex (Index Lookup)
    
  •                                     ||
    
  •                                     ||
    
  •                                     V
    
  •                           UnorderedPrimaryKeyDistinct (Index Lookup)
    
  •                                      |
    
  •                                      |
    
  •                         RecordQueryPlanWithIndex (Covering Index)
    

jleach4 added a commit to jleach4/fdb-record-layer that referenced this issue Jul 14, 2020
@nschiefer nschiefer changed the title Delay Index Fetches to minimize # of base records loaded Perform record fetches after union/intersection operators where possible Index Fetches to minimize # of base records loaded Jul 27, 2020
@nschiefer nschiefer changed the title Perform record fetches after union/intersection operators where possible Index Fetches to minimize # of base records loaded Perform record fetches after union/intersection operators where possible Jul 27, 2020
@MMcM MMcM added enhancement New feature or request planner Related to the query planner labels Jul 28, 2020
nschiefer added a commit to nschiefer/fdb-record-layer that referenced this issue Jul 30, 2020
…ction.

Implements a delicate-but-working pushdown of union, intersection, and
primary key distinct operations below the record fetch (from an index
scan) within the RecordQueryPlanner.

This is a fairly delicate operation that isn't easy to express properly
within the RecordQueryPlanner. In a number of places, the transformation
as expressed is incorrect, but happens to be correct in all the
circumstances where we happen to use it.

Because the execution framework cannot currently manipulate streams of
objects other than records, index entries are represented as partial
records, as in covering index scans.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planner Related to the query planner
Projects
None yet
Development

No branches or pull requests

2 participants