MatrixSynapse/synapse/storage
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
..
controllers Replace `EventContext` fields `prev_group` and `delta_ids` with field `state_group_deltas` (#15233) 2023-06-13 13:22:06 -07:00
databases devices: use combined ANY clause for faster cleanup (#15861) 2023-07-03 16:39:38 +02:00
engines Add a timeout that aborts any Postgres statement taking more than 1 hour. (#15853) 2023-07-03 11:38:57 +01:00
schema Fix sqlite `user_filters` upgrade (#15817) 2023-06-27 09:41:42 +01:00
util Combine AbstractStreamIdTracker and AbstractStreamIdGenerator. (#15192) 2023-03-03 08:13:37 -05:00
__init__.py Rename storage classes (#12913) 2022-05-31 12:17:50 +00:00
_base.py Clear event caches when we purge history (#15609) 2023-06-08 13:14:40 +01:00
background_updates.py Quick & dirty metric for background update status (#15740) 2023-06-07 17:12:23 +00:00
database.py Don't always lock "user_ips" table when performing non-native upsert (#15788) 2023-06-16 15:25:44 +01:00
keys.py
prepare_database.py Add type hints to schema deltas (#15497) 2023-04-27 12:44:53 +00:00
push_rule.py
roommember.py
types.py More precise type for LoggingTransaction.execute (#15432) 2023-04-14 18:04:49 +00:00