Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Manually set n_distinct for event_search.room_id to avoid bad Postgres query plans #14402

@erikjohnston

Description

@erikjohnston

On matrix.org we discovered that every now and again event_search queries would take forever due to using the wrong query plan. This was due to Postgres underestimating the number of room IDs that existed.

To fix this we should add a schema update with:

ALTER TABLE event_search ALTER COLUMN room_id SET (n_distinct = -0.01);

like we do for state_groups_state.state_group already.

Metadata

Metadata

Assignees

Labels

A-Message-SearchSearching messagesO-FrequentAffects or can be seen by most users regularly or impacts most users' first experienceS-MajorMajor functionality / product severely impaired, no satisfactory workaround.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions