-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[D1] Adding PRAGMA optimize for D1 #19996
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
Conversation
|
|
||
| Attempts to [optimize all schemas]() in a database by running various maintenance operations. We recommend running this command after [creating an index](/d1/best-practices/use-indexes/). | ||
|
|
||
| Alternatively, to see all optimizations that would have been performed without actually executing them, run `PRAGMA optimize(-1)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way D1 implements PRAGMA optimize, debug mode won't work since we constrain PRAGMA optimize to not return any rows.
As far as I can tell from reading the source code, debug mode returns a list of ANALYZE schema_name.table_name statements that PRAGMA optimize would have otherwise run.
@vy-ton I guess we should get debug mode to work, shouldn't we? Sorry for missing that detail. It's not documented at all! I had to read the source to figure it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should get debug mode to work, shouldn't we?
@justin-mp Would be nice to close out the pragma optimize loop but I wouldn't rank it high given other dev week priorities. let's make sure to at least create a tracking ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Oxyjun Given debug mode doesnt work, I would mention that PRAGMA optimize(-1) explicitly is not supported yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should get debug mode to work, shouldn't we?
@justin-mp Would be nice to close out the
pragma optimizeloop but I wouldn't rank it high given other dev week priorities. let's make sure to at least create a tracking ticket.
See cloudflare/workerd#3595 for the fix.
Co-authored-by: Vy Ton <[email protected]>
we don't support PRAGMA optimize(-1).
Summary
Screenshots (optional)
Documentation checklist