summary refs log tree commit diff
path: root/stubs
diff options
context:
space:
mode:
authorpacien <pacien@users.noreply.github.com>2023-07-03 16:39:38 +0200
committerGitHub <noreply@github.com>2023-07-03 16:39:38 +0200
commit07d7cbfe69c239a7ffe5668c1166799370eef0d6 (patch)
tree912961198d7ac4c2923dabaeea660ae0c834e4f6 /stubs
parentFix the `devenv up` configuration which was ignoring the config overrides. (#... (diff)
downloadsynapse-07d7cbfe69c239a7ffe5668c1166799370eef0d6.tar.xz
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>
Diffstat (limited to 'stubs')
0 files changed, 0 insertions, 0 deletions