Closed Bug 1800371 Opened 3 years ago Closed 3 years ago

Optimize orphan icons delete query

Categories

(Toolkit :: Places, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: mak, Assigned: mak)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The current query is slower than a NOT EXISTS because it has to extract the id from moz_pages_w_icons

old query plan
3 0 0 SCAN TABLE moz_pages_w_icons
6 0 0 USING INDEX moz_places_url_hashindex FOR IN-OPERATOR
18 0 0 LIST SUBQUERY 2
21 18 0 SCAN TABLE moz_icons_to_pages
47 0 0 SEARCH TABLE moz_icons_to_pages USING PRIMARY KEY (page_id=?)

new query plan
3 0 0 SCAN TABLE moz_pages_w_icons
6 0 0 USING INDEX moz_places_url_hashindex FOR IN-OPERATOR
15 0 0 CORRELATED SCALAR SUBQUERY 2
19 15 0 SEARCH TABLE moz_icons_to_pages USING PRIMARY KEY (page_id=?)
36 0 0 SEARCH TABLE moz_icons_to_pages USING PRIMARY KEY (page_id=?)

The new query on my system takes 100ms VS 150ms of the old one (tested updating DB Browser for Sqlite to the latest sqlite3.dll from sqlite.org)

Avoids a table scan, saving some time.
Functionality is already covered by existing tests.

Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/faa4cea6d364 Optimize orphan icons delete query. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: