simonw / datasette

An open source multi-tool for exploring and publishing data
https://datasette.io
Apache License 2.0
9.39k stars 668 forks source link

run analyze on all databases as part of start up or publishing #1586

Open fgregg opened 2 years ago

fgregg commented 2 years ago

Running analyze; lets sqlite's query planner make much better use of any indices.

It might be nice if the analyze was run as part of the start up of "serve" or "publish".

simonw commented 2 years ago

Running it as part of datasette publish is a smart idea - I'm slightly nervous about modifying the database file that has been published though, since part of the undocumented contract right now is that the bytes served are the exact same bytes as the ones you ran the publish against.

But there's no reason for that expectation to exist, and I doubt anyone is relying on that.