summary refs log tree commit diff
path: root/synapse/storage/schema/delta/40
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-11-01 19:10:33 +0000
committerRichard van der Hoff <richard@matrix.org>2018-11-02 10:36:13 +0000
commit350f654e7b80ff19d1fdf3861093cef09ccf3ab1 (patch)
tree2c19dd58dc5ae54ac36d0e4f85fc882bb019c618 /synapse/storage/schema/delta/40
parentRemove redundant database locks for device list updates (diff)
downloadsynapse-350f654e7b80ff19d1fdf3861093cef09ccf3ab1.tar.xz
Add unique indexes to a couple of tables
The indexes on device_lists_remote_extremeties can be unique, and they
therefore should, to ensure that the db remains consistent.
Diffstat (limited to 'synapse/storage/schema/delta/40')
-rw-r--r--synapse/storage/schema/delta/40/device_list_streams.sql9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/storage/schema/delta/40/device_list_streams.sql b/synapse/storage/schema/delta/40/device_list_streams.sql
index 54841b3843..dd6dcb65f1 100644
--- a/synapse/storage/schema/delta/40/device_list_streams.sql
+++ b/synapse/storage/schema/delta/40/device_list_streams.sql
@@ -20,9 +20,6 @@ CREATE TABLE device_lists_remote_cache (
     content TEXT NOT NULL
 );
 
-CREATE INDEX device_lists_remote_cache_id ON device_lists_remote_cache(user_id, device_id);
-
-
 -- The last update we got for a user. Empty if we're not receiving updates for
 -- that user.
 CREATE TABLE device_lists_remote_extremeties (
@@ -30,7 +27,11 @@ CREATE TABLE device_lists_remote_extremeties (
     stream_id TEXT NOT NULL
 );
 
-CREATE INDEX device_lists_remote_extremeties_id ON device_lists_remote_extremeties(user_id, stream_id);
+-- we used to create non-unique indexes on these tables, but as of update 52 we create
+-- unique indexes concurrently:
+--
+-- CREATE INDEX device_lists_remote_cache_id ON device_lists_remote_cache(user_id, device_id);
+-- CREATE INDEX device_lists_remote_extremeties_id ON device_lists_remote_extremeties(user_id, stream_id);
 
 
 -- Stream of device lists updates. Includes both local and remotes