Skip to content

Conversation

@Oxyjun
Copy link
Contributor

@Oxyjun Oxyjun commented Feb 14, 2025

Summary

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

@Oxyjun Oxyjun self-assigned this Feb 14, 2025
@Oxyjun Oxyjun requested review from a team, elithrar and vy-ton as code owners February 14, 2025 15:28
@Oxyjun Oxyjun marked this pull request as draft February 14, 2025 15:29
@github-actions github-actions bot added the product:d1 D1: https://developers.cloudflare.com/d1/ label Feb 14, 2025
@Oxyjun Oxyjun marked this pull request as ready for review February 17, 2025 16:35
@github-actions github-actions bot added size/s and removed size/xs labels Feb 17, 2025

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)`.
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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.

See cloudflare/workerd#3595 for the fix.

@Oxyjun Oxyjun enabled auto-merge (squash) February 24, 2025 09:22
@Oxyjun Oxyjun merged commit dfc9e77 into production Feb 24, 2025
11 checks passed
@Oxyjun Oxyjun deleted the jun/d1/pragma-optimise branch February 24, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:d1 D1: https://developers.cloudflare.com/d1/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants