Skip to content

Commit

Permalink
docs: manual state_groups_state cleanup
Browse files Browse the repository at this point in the history
Document workaround until element-hq#12821 is implemented
  • Loading branch information
csett86 authored Apr 13, 2024
1 parent fe4719a commit f18a89c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/usage/administration/useful_sql_for_admins.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ public.device_lists_remote_cache - 124 MB
public.state_group_edges - 122 MB
```

## Cleanup large state_groups_state table
The state_groups_state table may contain a large number of entries from rooms that are no longer known to the server.
See https://github.com/element-hq/synapse/issues/12821 for background.

```sql
SELECT COUNT(*) state_groups_state WHERE room_id NOT IN (SELECT DISTINCT room_id FROM events);
```

To delete them, shut down synapse and delete them and then start synapse again.

```sql
DELETE FROM state_groups_state WHERE room_id NOT IN (SELECT DISTINCT room_id FROM events);
```

## Show top 20 larger rooms by state events count
You get the same information when you use the
[admin API](../../admin_api/rooms.md#list-room-api)
Expand Down

0 comments on commit f18a89c

Please sign in to comment.