summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-01-24 13:57:12 +0000
committerGitHub <noreply@github.com>2024-01-24 13:57:12 +0000
commitadf15c4f6b856c3dfc98904a039f678cac036c1f (patch)
treed9e1537dcab9a3c29a6e0a859f2f6d6504d07f0a /synapse/storage
parentTweak changelog (diff)
downloadsynapse-adf15c4f6b856c3dfc98904a039f678cac036c1f.tar.xz
Run `ANALYZE` after fiddling with stats (#16849)
Introduced in #16833

Fixes #16844
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres2
-rw-r--r--synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres16
2 files changed, 18 insertions, 0 deletions
diff --git a/synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres b/synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres
index b0b41bd106..0c3ae979eb 100644
--- a/synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres
+++ b/synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres
@@ -16,3 +16,5 @@
 -- figuring that out by itself.
 ALTER TABLE event_auth_chain_links ALTER origin_chain_id SET (n_distinct = -0.5);
 ALTER TABLE event_auth_chain_links ALTER target_chain_id SET (n_distinct = -0.5);
+
+-- We should have done an `ANALYZE event_auth_chain_links` here, but we forgot.
diff --git a/synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres b/synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres
new file mode 100644
index 0000000000..aecb72a477
--- /dev/null
+++ b/synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres
@@ -0,0 +1,16 @@
+--
+-- This file is licensed under the Affero General Public License (AGPL) version 3.
+--
+-- Copyright (C) 2023 New Vector, Ltd
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU Affero General Public License as
+-- published by the Free Software Foundation, either version 3 of the
+-- License, or (at your option) any later version.
+--
+-- See the GNU Affero General Public License for more details:
+-- <https://www.gnu.org/licenses/agpl-3.0.html>.
+
+-- We need to do an ANALYZE after `01_auth_links_stats.sql.postgres`, where we
+-- fiddled with the stats.
+ANALYZE event_auth_chain_links;