Skip to content
Commit Detail

Commit ef29a6d

Author
Justin Mazzola Paluska <jmp@cloudflare.com> 2025-02-06 14:47:24 -0500
Parents
3dce7bb
Tree
35594bd
sqlite: allow pragmas and statements needed to run the query optimizer

https://www.sqlite.org/lang_analyze.html recommends a bunch of things
one can do to optimize the performance of the query planner.  Most
folks using Durable Objects will probably be best served by just
calling `PRAGMA optimize` after making schema changes.

A couple of notes about this commit:

* `PRAGMA optimize` may call `ANALYZE` on all tables, including the
  internal `_cf_` tables, so we have to allow `ANALYZE` even on
  otherwise disallowed table names.

* Calls to `ANALYZE`, either directly or via `PRAGMA optimize`, cause
  the creation of the `sqlite_stat1` table.  This caused some noise in
  sql-test.js as I had to update tests that depend on (a) the particular
  set of tables in the database and (b) the particular size of the
  database.

Files changed

2 files changed~2 modified