add txo_unspent_by_address index

This commit is contained in:
Lex Berezhny 2020-10-21 13:53:37 -04:00
parent 22a04fab24
commit 4d8cc494e1

View file

@ -159,6 +159,9 @@ pg_add_txo_constraints_and_indexes = [
# for calculating supports on a claim # for calculating supports on a claim
f"CREATE INDEX txo_unspent_supports ON txo (claim_hash) INCLUDE (amount) " f"CREATE INDEX txo_unspent_supports ON txo (claim_hash) INCLUDE (amount) "
f"WHERE spent_height = 0 AND txo_type={TXO_TYPES['support']};", f"WHERE spent_height = 0 AND txo_type={TXO_TYPES['support']};",
# for calculating balance
f"CREATE INDEX txo_unspent_by_address ON txo (address) INCLUDE (amount) "
f"WHERE spent_height = 0;",
# for finding modified claims in a block range # for finding modified claims in a block range
f"CREATE INDEX txo_claim_changes " f"CREATE INDEX txo_claim_changes "
f"ON txo (height DESC) INCLUDE (claim_hash, txo_hash) " f"ON txo (height DESC) INCLUDE (claim_hash, txo_hash) "