Closed Bug 1539621 Opened 6 years ago Closed 6 years ago

Investigate 'PRAGMA optimize'

Categories

(Firefox for iOS :: Data Storage, enhancement, P1)

Other
iOS
enhancement

Tracking

()

RESOLVED FIXED
Tracking Status
fxios 16.0 ---

People

(Reporter: justindarc, Assigned: justindarc)

Details

Assignee: nobody → jdarcangelo
Status: NEW → ASSIGNED
Priority: -- → P1

Nervous about doing this on close, and the implications of killing the process while the DB is being optimized. I wonder what is the added risk of DB corruption from this.

I don't want to do it on close either since one of the cases where we call close() is when we're being forced to shutdown by the OS. We already have a good spot for this where we check if we need to prune old history at startup. Also, the documentation says:

This pragma is usually a no-op or nearly so and is very fast.

It also looks like you can supply arguments to limit which optimization routines it performs. I think we can safely do this at startup with little-to-no performance penalty (except for maybe the first time it runs on a large DB that hasn't been optimized yet). I'll investigate this further and see what we should do.

Also, I was mistaken before when I said that we are already running VACUUM regularly. It seems that the only time it is run currently is if the user clears their history. We should also probably run this during our optimization/pruning routines at startup, but not nearly as often.

Actually, I'm wrong. The proper time to do this is at close. It uses the stats gathered throughout the life of the connection to make optimizations. More often than not, it is a no-op, but even when it does do work, it completes very quickly.

Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.