Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve performance of remove_{hidden,deleted}_devices_from_device_inbox #11421

Merged
merged 19 commits into from
Nov 25, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't use table aliases on DELETE
Because old sqlite doesn't support it
  • Loading branch information
babolivier committed Nov 25, 2021
commit c294bbb3c777031b1c55bb9c0522b010bd622d1c
8 changes: 4 additions & 4 deletions synapse/storage/databases/main/deviceinbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,14 @@ def _remove_devices_from_device_inbox_txn(
stop = start + batch_size

sql = """
babolivier marked this conversation as resolved.
Show resolved Hide resolved
DELETE FROM device_inbox AS di
DELETE FROM device_inbox
WHERE
stream_id >= ? AND stream_id < ?
AND NOT EXISTS (
SELECT * FROM devices AS d
SELECT * FROM devices d
WHERE
d.device_id=di.device_id
AND d.user_id=di.user_id
d.device_id=device_inbox.device_id
AND d.user_id=device_inbox.user_id
AND NOT hidden
)
"""
Expand Down