diff options
author | Richard van der Hoff <richard@matrix.org> | 2017-05-11 11:57:02 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2017-05-11 12:05:22 +0100 |
commit | baafb85ba461b7d5073de94422fed0c43a417f46 (patch) | |
tree | 272b3edc2fefcd5b3baa998a8c1e37226b7b8474 /synapse/storage/events.py | |
parent | Merge pull request #2214 from matrix-org/rav/hurry_up_purge (diff) | |
download | synapse-baafb85ba461b7d5073de94422fed0c43a417f46.tar.xz |
Add an index to event_search
- to make the purge API quicker
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index dbd63078c6..1fae1aeacf 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -207,6 +207,17 @@ class EventsStore(SQLBaseStore): where_clause="contains_url = true AND outlier = false", ) + # an event_id index on event_search is useful for the purge_history + # api. Plus it means we get to enforce some integrity with a UNIQUE + # clause + self.register_background_index_update( + "event_search_event_id_idx", + index_name="event_search_event_id_idx", + table="event_search", + columns=["event_id"], + unique=True, + ) + self._event_persist_queue = _EventPeristenceQueue() def persist_events(self, events_and_contexts, backfilled=False): |