Closed Bug 1556009 Opened 6 years ago Closed 3 years ago

Use new window functions to provide better position fixing in PlacesDBUtils

Categories

(Toolkit :: Places, task, P2)

65 Branch
task

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: standard8, Assigned: mak)

Details

Attachments

(1 file)

From the review comments in bug 1540669:

For PlacesDBUtils we could probably use PARTITION BY to update ALL the bookmarks:

WITH positions(id, pos, seq) AS (
SELECT id, position AS pos,(row_number() OVER (PARTITION BY parent ORDER BY position)) - 1 AS seq
FROM moz_bookmarks
)
UPDATE moz_bookmarks
SET position = (SELECT seq FROM positions WHERE positions.id = moz_bookmarks.id)
WHERE id IN ( SELECT id FROM positions WHERE seq <> pos);

Just note that using the row_number() window function we can likely fix all of the indexing problems we have around.

Priority: P3 → P2
Severity: normal → S3
Assignee: nobody → mak
Status: NEW → ASSIGNED
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/3a3942cde8aa Use a window function and update-from to fix bookmark indices. r=scunnane
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: