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

sql: propagate filters to virtual table generators #22504

Closed
knz opened this issue Feb 8, 2018 · 3 comments
Closed

sql: propagate filters to virtual table generators #22504

knz opened this issue Feb 8, 2018 · 3 comments
Assignees
Labels
A-sql-optimizer SQL logical planning and optimizations. C-performance Perf of queries or internals. Solution not expected to change functional behavior.

Comments

@knz
Copy link
Contributor

knz commented Feb 8, 2018

The overhead of producing the vtable data is already showing up in performance reports after the set of descriptor grows sufficiently large (#20753). Also ORMs like to use complex joins with virtual tables, and virtual tables can contain lots of data, we'd like to limit the amount of data generated in-memory if the outer query applies filters or a join condition.

A cache was mentioned previously (#12025) but it does not reduce the amount of data pulled into e.g. a complex join without filtering. Also the cache invalidation conditions for virtual tables is likely very complex (each vtable's contents reflects a different part of the state of the db).

A proper solution would be to have the vtable generator function take a filter as parameter, and only produce data for those that match the filter.

Also most vtables have a natural primary key; the generator function can take the struct that represents column constraints and use that to constrain the generation loops.

cc @petermattis

@knz knz added the C-performance Perf of queries or internals. Solution not expected to change functional behavior. label Feb 8, 2018
@knz knz added this to the 2.1 milestone Feb 8, 2018
@nvanbenschoten
Copy link
Member

The overhead of producing the vtable data is already showing up in performance reports after the set of descriptor grows sufficiently large (#20753).

I'm on-board with this proposal, but we should note that the overhead of vtable queries explored in #20753 was completely dominated by the repeated descriptor lookups. Now that we cache these, we should re-examine whether this is still an issue before investing significant effort.

@knz knz added the A-sql-optimizer SQL logical planning and optimizations. label Apr 29, 2018
@jordanlewis jordanlewis modified the milestones: 2.1, 2.2 Sep 5, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
@RoachietheSupportRoach
Copy link
Collaborator

Zendesk ticket #4349 has been linked to this issue.

@jordanlewis jordanlewis self-assigned this Apr 17, 2020
@jordanlewis
Copy link
Member

I forgot to close this, it got fixed by #47316.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-optimizer SQL logical planning and optimizations. C-performance Perf of queries or internals. Solution not expected to change functional behavior.
Projects
None yet
Development

No branches or pull requests

5 participants