MatrixSynapse/synapse
pacien 07d7cbfe69
devices: use combined ANY clause for faster cleanup (#15861)
Old device entries for the same user were being removed in individual
SQL commands, making the batch take way longer than necessary.

This combines the commands into a single one with a IN/ANY clause.

Example of log entry before the change, regularly observed with
"log_min_duration_statement = 10000" in PostgreSQL's config:

    LOG:  duration: 42538.282 ms  statement:
    DELETE FROM device_lists_stream
    WHERE user_id = '@someone' AND device_id = 'someid1'
    AND stream_id < 123456789
    ;
    DELETE FROM device_lists_stream
    WHERE user_id = '@someone' AND device_id = 'someid2'
    AND stream_id < 123456789
    ;
    [repeated for each device ID of that user, potentially a lot...]

With the patch applied on my instance for the past couple of days, I
no longer notice overly long statements of that particular kind.

Signed-off-by: pacien <pacien.trangirard@pacien.net>
2023-07-03 16:39:38 +02:00
..
_scripts Fix harmless exception in port DB script (#15814) 2023-06-21 13:20:46 +00:00
api Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
app Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
appservice Consolidate logic to check for deactivated users. (#15634) 2023-05-23 10:35:43 -04:00
config Allow for the configuration of max request retries and min/max retry delays in the matrix federation client (#15783) 2023-06-21 10:41:11 +02:00
crypto Factor out an `is_mine_server_name` method (#15542) 2023-05-05 15:06:22 +01:00
events Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
federation Regularly try to wake up dests instead of waiting for next PDU/EDU (#15743) 2023-06-16 10:15:12 +00:00
handlers Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
http Add login spam checker API (#15838) 2023-06-26 14:12:20 +00:00
logging Trace functions which return `Awaitable` (#15650) 2023-06-06 17:39:22 -05:00
media Fix unsafe hotserving behaviour for non-multimedia uploads. (#15680) 2023-06-15 14:23:27 +01:00
metrics Quick & dirty metric for background update status (#15740) 2023-06-07 17:12:23 +00:00
module_api Add login spam checker API (#15838) 2023-06-26 14:12:20 +00:00
push Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
replication Add Unix socket support for Redis connections (#15644) 2023-05-26 15:28:39 -04:00
res Use oEmbed for YouTube Shorts (#15025) 2023-05-03 12:54:42 -04:00
rest Add login spam checker API (#15838) 2023-06-26 14:12:20 +00:00
server_notices Remove unused `room_alias` field from `/createRoom` response (#15093) 2023-02-22 11:07:28 +00:00
spam_checker_api Fix import in module_api module and docs on the new check_event_for_spam signature (#12918) 2022-05-31 12:04:53 +02:00
state Instrument `state` and `state_group` storage related things (tracing) (#15610) 2023-05-19 12:26:58 -05:00
static Remove registration fallback code. (#15405) 2023-04-13 11:36:29 -04:00
storage devices: use combined ANY clause for faster cleanup (#15861) 2023-07-03 16:39:38 +02:00
streams Use mypy 1.0 (#15052) 2023-02-16 16:09:11 +00:00
types Fix empty scope when having version mismatch between workers (#15774) 2023-06-14 11:53:55 +02:00
util Prefill events after invalidate not before when persisting events (#15758) 2023-06-14 09:42:18 +01:00
__init__.py Use immutabledict instead of frozendict (#15113) 2023-03-22 17:15:34 +00:00
event_auth.py Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
notifier.py Move ThirdPartyEventRules into module_api/callbacks (#15535) 2023-05-04 14:18:22 +00:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
visibility.py Log when events are (unexpectedly) filtered out of responses in tests (#14213) 2023-06-01 21:27:18 -05:00