This blog post by Victor Berger explains how to use many of the tools listed on this page:

List of useful tools and scripts for maintenance Synapse database:

Purge Remote Media API

The purge remote media API allows server admins to purge old cached remote media.

Purge Local Media API

This API deletes the local media from the disk of your own server.

Purge History API

The purge history API allows server admins to purge historic events from their database, reclaiming disk space.


Tool for compressing (deduplicating) state_groups_state table.

SQL for analyzing Synapse PostgreSQL database stats

Some easy SQL that reports useful stats about your Synapse database.