Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Old dead users cause large number of inserts to event_push_actions #5569

Open
erikjohnston opened this issue Jun 26, 2019 · 2 comments
Open
Labels
A-Disk-Space things which fill up the disk A-Performance Performance, both client-facing and admin-facing A-Push Issues related to push/notifications O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@erikjohnston
Copy link
Member

matrix.org inserts a lot of rows into event_push_actions (and _staging) for users that have long since disappeared. We should do something to reduce that.

(We insert a row per user per room for each event that notifies people, so messages in large rooms cause a lot of rows to be inserted)

@erikjohnston
Copy link
Member Author

erikjohnston commented Jun 26, 2019

A temporary solution is to delete read receipts of all users that haven't been seen for more than six months, who have more than 1000 notifications in that room. This will stop new event push actions to generated, resulting in their counts no longer being updated (till they next look into the room). This is probably fine because I believe Riot caps notification counts to 99+ or something anyway.

Query to get those rooms/users:

SELECT user_id, room_id FROM event_push_summary
INNER JOIN user_ips USING (user_id)
WHERE notif_count > 1000
GROUP BY user_id, room_id
HAVING to_timestamp(max(last_seen)/1000) < '2019-01-01';

@neilisfragile neilisfragile added A-Performance Performance, both client-facing and admin-facing z-p2 (Deprecated Label) labels Jun 27, 2019
@uriesk
Copy link

uriesk commented Jul 21, 2022

i put this in a cron job

delete from event_push_actions u where room_id = '${room}' and not exists ( select from user_ips where user_id = u.user_id and to_timestamp(last_seen/1000) > now() - interval '10 weeks' )

to clean the event_push_actions

How would i delete read receipts?

My event_push_actions fills up very very fast, because i have lots of puppets from a bridge who never read notifications.

@babolivier babolivier added A-Push Issues related to push/notifications S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Jul 21, 2022
@reivilibre reivilibre added the A-Disk-Space things which fill up the disk label Jul 27, 2022
@erikjohnston erikjohnston added O-Occasional Affects or can be seen by some users regularly or most users rarely and removed z-p2 (Deprecated Label) labels Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Disk-Space things which fill up the disk A-Performance Performance, both client-facing and admin-facing A-Push Issues related to push/notifications O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

5 participants