-
Notifications
You must be signed in to change notification settings - Fork 5.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
[D1] Adding PRAGMA optimize for D1 #19996
base: production
Are you sure you want to change the base?
Conversation
Preview URL: https://66756e29.preview.developers.cloudflare.com Files with changes (up to 15)
|
|
||
### `PRAGMA optimize` | ||
|
||
Attempts to optimize all schemas in a database by running various maintenance operations. |
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.
Need to connect optimize all schemas
with query optimization
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.
Can I check which section you're referring to here?
|
||
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.
Summary
Screenshots (optional)
Documentation checklist