forked-synapse/changelog.d
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
..
.gitignore Correct attrs package name in requirements (#3492) 2018-07-07 10:46:59 +10:00
15846.misc Split out 2022 changes from the changelog (#15846) 2023-06-28 15:10:33 -05:00
15853.misc Add a timeout that aborts any Postgres statement taking more than 1 hour. (#15853) 2023-07-03 11:38:57 +01:00
15854.misc Fix the devenv up configuration which was ignoring the config overrides. (#15854) 2023-07-03 11:39:52 +01:00
15861.misc devices: use combined ANY clause for faster cleanup (#15861) 2023-07-03 16:39:38 +02:00