Skip to content

Commit adf15c4

Browse files
authored
Run ANALYZE after fiddling with stats (#16849)
Introduced in #16833 Fixes #16844
1 parent 594842c commit adf15c4

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

changelog.d/16849.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix database performance regression due to changing Postgres table statistics. Introduced in v1.100.0rc1.

synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres

+2
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
-- figuring that out by itself.
1717
ALTER TABLE event_auth_chain_links ALTER origin_chain_id SET (n_distinct = -0.5);
1818
ALTER TABLE event_auth_chain_links ALTER target_chain_id SET (n_distinct = -0.5);
19+
20+
-- We should have done an `ANALYZE event_auth_chain_links` here, but we forgot.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--
2+
-- This file is licensed under the Affero General Public License (AGPL) version 3.
3+
--
4+
-- Copyright (C) 2023 New Vector, Ltd
5+
--
6+
-- This program is free software: you can redistribute it and/or modify
7+
-- it under the terms of the GNU Affero General Public License as
8+
-- published by the Free Software Foundation, either version 3 of the
9+
-- License, or (at your option) any later version.
10+
--
11+
-- See the GNU Affero General Public License for more details:
12+
-- <https://www.gnu.org/licenses/agpl-3.0.html>.
13+
14+
-- We need to do an ANALYZE after `01_auth_links_stats.sql.postgres`, where we
15+
-- fiddled with the stats.
16+
ANALYZE event_auth_chain_links;

0 commit comments

Comments
 (0)