From cce5d057d34ac6fc953d1987bbce3bce2ce42bd8 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 15 Apr 2015 11:43:25 +0100 Subject: Add index on events (topological_ordering, stream_ordering) to help with ORDER BY clauses --- synapse/storage/schema/delta/16/events_order_index.sql | 1 + synapse/storage/schema/full_schemas/16/im.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 synapse/storage/schema/delta/16/events_order_index.sql diff --git a/synapse/storage/schema/delta/16/events_order_index.sql b/synapse/storage/schema/delta/16/events_order_index.sql new file mode 100644 index 0000000000..c015414663 --- /dev/null +++ b/synapse/storage/schema/delta/16/events_order_index.sql @@ -0,0 +1 @@ +CREATE INDEX events_order ON events (topological_ordering, stream_ordering); \ No newline at end of file diff --git a/synapse/storage/schema/full_schemas/16/im.sql b/synapse/storage/schema/full_schemas/16/im.sql index a661fc160c..b8faed5066 100644 --- a/synapse/storage/schema/full_schemas/16/im.sql +++ b/synapse/storage/schema/full_schemas/16/im.sql @@ -29,6 +29,7 @@ CREATE TABLE IF NOT EXISTS events( CREATE INDEX events_stream_ordering ON events (stream_ordering); CREATE INDEX events_topological_ordering ON events (topological_ordering); +CREATE INDEX events_order ON events (topological_ordering, stream_ordering); CREATE INDEX events_room_id ON events (room_id); -- cgit 1.4.1