On 4 Oct 2017, at 5:06pm, Jens Alfke <j...@mooseyard.com> wrote:

> That’s an interesting idea. I’ve been assuming that ANALYZE was dependent on 
> the exact contents of the database, but if its results can be canned and 
> applied to new databases, that’s a good optimization.

It works and I’ve seen it suggested elsewhere though I’ve never used it.  
ANALYZE does not expect the stats tables to match the data.  It’s used to 
record tables lengths and 'chunkiness' to guide the optimizer.  And even if the 
stats tables are out of date, the optimizer is so good anyway that the 
difference it makes may not be great.

Users could do ANALYZE in a maintenance procedure perhaps once a year, or even 
just during a user-triggered "disk-check" routine, as is done in my PVR.  
'chunkiness' of data doesn’t change much over the life of a database.

sqlite-users mailing list

Reply via email to