Open Bug 1420597 Opened 3 years ago Updated 2 years ago

Writes visits to a temp table first, merge on a timer


(Toolkit :: Places, enhancement, P3)





(Reporter: mak, Unassigned)


(Blocks 1 open bug)


(Keywords: perf, Whiteboard: [fxsearch])

Currently for each visit we do 3 writes (or more due to frecency):
1. we insert the visit, insert or update a place at the same time.
2. we update the title, that comes later than the visit
3. we update the metadata, that comes later than the title
Additionally we update frecency after the visit insert.

We could retry a similar approach to what we did in the past, partition moz_places in memory and on a timer merge it to disk. Or we could build a memory table with all the needed info.
This would reduce the writes to 1 or 2. To avoid complicating too much the thing, we could still add the visit immediately and delay just the title and metadata, or we could try delaying everything.

There are some drawbacks:
1. in case of immediate shutdown/crash, we could have a tiny dataloss. Nothing crazy, it's mostly stuff we would fetch again at the next visit.
2. Reads would either act on an outdated snapshot, or would need to read from a view that merges the 2 tables. Views can't use indices though. If we limit the behavior to visits added through the docshell and metadata writing, it may be fine to use an outdated snapshot.
3. Some views would update only after the real insertion. The timer in general would be short, 2 or 3 seconds.

This needs some investigation and experimenting.
Blocks: PlacesIO
No longer blocks: 1419053
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.