summary refs log tree commit diff
path: root/docs/admin_api/statistics.md
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2023-04-26 17:00:11 +0100
committerGitHub <noreply@github.com>2023-04-26 16:00:11 +0000
commit9900f7c231f8af536fce229117b0a406dc629293 (patch)
treea688fbc4cf51b64fa4821d19e200f8f50e3a0427 /docs/admin_api/statistics.md
parentUpdate the `check_schema_delta` script to account for when the schema version... (diff)
downloadsynapse-9900f7c231f8af536fce229117b0a406dc629293.tar.xz
Add admin endpoint to query room sizes (#15482)
Diffstat (limited to 'docs/admin_api/statistics.md')
-rw-r--r--docs/admin_api/statistics.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/admin_api/statistics.md b/docs/admin_api/statistics.md
index 03b3621e55..2bd417e900 100644
--- a/docs/admin_api/statistics.md
+++ b/docs/admin_api/statistics.md
@@ -81,3 +81,52 @@ The following fields are returned in the JSON response body:
   - `user_id` - string - Fully-qualified user ID (ex. `@user:server.com`).
 * `next_token` - integer - Opaque value used for pagination. See above.
 * `total` - integer - Total number of users after filtering.
+
+
+# Get largest rooms by size in database
+
+Returns the 10 largest rooms and an estimate of how much space in the database
+they are taking.
+
+This does not include the size of any associated media associated with the room.
+
+Returns an error on SQLite.
+
+*Note:* This uses the planner statistics from PostgreSQL to do the estimates,
+which means that the returned information can vary widely from reality. However,
+it should be enough to get a rough idea of where database disk space is going.
+
+
+The API is:
+
+```
+GET /_synapse/admin/v1/statistics/statistics/database/rooms
+```
+
+A response body like the following is returned:
+
+```json
+{
+  "rooms": [
+    {
+      "room_id": "!OGEhHVWSdvArJzumhm:matrix.org",
+      "estimated_size": 47325417353
+    }
+  ],
+}
+```
+
+
+
+**Response**
+
+The following fields are returned in the JSON response body:
+
+* `rooms` - An array of objects, sorted by largest room first. Objects contain
+  the following fields:
+  - `room_id` - string - The room ID.
+  - `estimated_size` - integer - Estimated disk space used in bytes by the room
+    in the database.
+
+
+*Added in Synapse 1.83.0*