Merge pull request #1079 from matrix-org/erikj/state_seqscan

Temporarily disable sequential scans for state fetching
pull/1081/head
Erik Johnston 2016-09-08 09:55:16 +01:00 committed by GitHub
commit 2982d16e07
1 changed files with 4 additions and 0 deletions

View File

@ -310,6 +310,10 @@ class StateStore(SQLBaseStore):
results = {group: {} for group in groups}
if isinstance(self.database_engine, PostgresEngine):
# Temporarily disable sequential scans in this transaction. This is
# a temporary hack until we can add the right indices in
txn.execute("SET LOCAL enable_seqscan=off")
# The below query walks the state_group tree so that the "state"
# table includes all state_groups in the tree. It then joins
# against `state_groups_state` to fetch the latest state.