Add index on transaction_id to sent_transcations

This commit is contained in:
Erik Johnston 2015-01-06 15:40:38 +00:00
parent 9bd07bed23
commit f6da237c35
2 changed files with 1 additions and 4 deletions

View file

@ -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( CREATE INDEX IF NOT EXISTS sent_transaction_dest_referenced ON sent_transactions(
destination 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 -- So that we can do an efficient look up of all transactions that have yet to be successfully
-- sent. -- sent.
CREATE INDEX IF NOT EXISTS sent_transaction_sent ON sent_transactions(response_code); CREATE INDEX IF NOT EXISTS sent_transaction_sent ON sent_transactions(response_code);

View file

@ -19,8 +19,6 @@ from collections import namedtuple
from twisted.internet import defer from twisted.internet import defer
from synapse.util.logutils import time_function
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -200,7 +198,6 @@ class TransactionStore(SQLBaseStore):
self._get_transactions_after, transaction_id, destination self._get_transactions_after, transaction_id, destination
) )
@time_function
def _get_transactions_after(cls, txn, transaction_id, destination): def _get_transactions_after(cls, txn, transaction_id, destination):
where = ( where = (
"destination = ? AND id > (select id FROM %s WHERE " "destination = ? AND id > (select id FROM %s WHERE "
@ -231,7 +228,6 @@ class TransactionStore(SQLBaseStore):
"get_destination_retry_timings", "get_destination_retry_timings",
self._get_destination_retry_timings, destination) self._get_destination_retry_timings, destination)
@time_function
def _get_destination_retry_timings(cls, txn, destination): def _get_destination_retry_timings(cls, txn, destination):
query = DestinationsTable.select_statement("destination = ?") query = DestinationsTable.select_statement("destination = ?")
txn.execute(query, (destination,)) txn.execute(query, (destination,))