From f6da237c353d598946a6c81260653203602800c2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 6 Jan 2015 15:40:38 +0000 Subject: [PATCH] Add index on transaction_id to sent_transcations --- synapse/storage/schema/transactions.sql | 1 + synapse/storage/transactions.py | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/synapse/storage/schema/transactions.sql b/synapse/storage/schema/transactions.sql index 86f530d82a..2d30f99b06 100644 --- a/synapse/storage/schema/transactions.sql +++ b/synapse/storage/schema/transactions.sql @@ -42,6 +42,7 @@ CREATE INDEX IF NOT EXISTS sent_transaction_dest ON sent_transactions(destinatio CREATE INDEX IF NOT EXISTS sent_transaction_dest_referenced ON sent_transactions( destination ); +CREATE INDEX IF NOT EXISTS sent_transaction_txn_id ON sent_transactions(transaction_id); -- So that we can do an efficient look up of all transactions that have yet to be successfully -- sent. CREATE INDEX IF NOT EXISTS sent_transaction_sent ON sent_transactions(response_code); diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py index 9d14f89303..e06ef35690 100644 --- a/synapse/storage/transactions.py +++ b/synapse/storage/transactions.py @@ -19,8 +19,6 @@ from collections import namedtuple from twisted.internet import defer -from synapse.util.logutils import time_function - import logging logger = logging.getLogger(__name__) @@ -200,7 +198,6 @@ class TransactionStore(SQLBaseStore): self._get_transactions_after, transaction_id, destination ) - @time_function def _get_transactions_after(cls, txn, transaction_id, destination): where = ( "destination = ? AND id > (select id FROM %s WHERE " @@ -231,7 +228,6 @@ class TransactionStore(SQLBaseStore): "get_destination_retry_timings", self._get_destination_retry_timings, destination) - @time_function def _get_destination_retry_timings(cls, txn, destination): query = DestinationsTable.select_statement("destination = ?") txn.execute(query, (destination,))