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
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
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
res
rest Add login spam checker API (#15838) 2023-06-26 14:12:20 +00:00
server_notices
spam_checker_api
state Instrument `state` and `state_group` storage related things (tracing) (#15610) 2023-05-19 12:26:58 -05:00
static
storage devices: use combined ANY clause for faster cleanup (#15861) 2023-07-03 16:39:38 +02:00
streams
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
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
py.typed
server.py Remove experimental MSC2716 implementation to incrementally import history into existing rooms (#15748) 2023-06-16 14:12:24 -05:00
visibility.py