-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
pass filter/limit/order to virtual tables #95766
Comments
@michae2 can you add a link in the JIRA ticket to the post-mortem document related to this issue? Can you also assign a priority and due date based on how important you think this is? If there is a status update, please leave a comment in the JIRA ticket, too. |
@maryliag my impression from recent discussions with you was that these virtual tables are not dependent on a system table, as there is a view that combines the virtual table and system table for use by other queries. Is this correct? If so, I'm not sure what SQL Queries can do to optimize purely in-memory virtual tables (i.e., we can't push filters down to an index, etc). |
We have a view that combines [in-memory view] + [system table] For example
|
Right, so this is a different problem, which has nothing to do with virtual tables. Even if you were to remove any reference to the virtual table from the above query, we would still not be able to push the limit down. Here I've re-written this query over the system table, and you can see that we cannot push the limit down (note the
There are a couple of reasons for this:
Maybe someone else on the team has a suggestion, but I currently don't see a way for us to better optimize this query. My suggestion would be to change the query so it can be more easily optimized, or if this is not possible, asynchronously load the data into a materialized view so that it's ready when needed. |
different problems, that one is for the query |
Thank you for the explanation Becca. We will look into other improvements we can make on the query |
Great, thanks. In that case I'm going to close this issue, but please let us know if we can help brainstorm how to rewrite the query so it's possible to optimize (or feel free to open another issue). |
Currently values for order/filter/limit are not passed on virtual tables, making the queries on them to be inefficient.
We use virtual tables on the console on several locations (e.g.
crdb_internal.statement_statistics
,crdb_internal.transaction_statistics
), but selects on them can take a long time to be executed since filters and limit are not being passed on.This change would allow all of sql observability queries to be more efficient and consequently the tables would take less time to load (it can take minutes when users have a lot of data).
Jira issue: CRDB-23723
The text was updated successfully, but these errors were encountered: