Closed Bug 1556010 Opened 5 years ago Closed 2 years ago

Use new window functions to provide better position fixing in reorderChildren

Categories

(Toolkit :: Places, task, P2)

65 Branch
task

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: standard8, Assigned: mak)

References

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.

We should see if we can apply this to reorderChildren().

Severity: normal → S3
Assignee: nobody → mak
Status: NEW → ASSIGNED
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/782a1acfd6fd
Use Sqlite window functions to provide better position fixing in reorderChildren. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 2 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: