Skip to content

Commit a56571a

Browse files
author
Mateusz Czeladka
committed
fix: improve performance on /account/balance for addresses with large transactions count. (quick wins)
1 parent 98714aa commit a56571a

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,4 @@ Further adjustments can be made by changing `.env.docker-compose` file. For more
117117

118118
---
119119
Thanks for visiting us and enjoy :heart:!
120+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DO $$
2+
BEGIN
3+
IF NOT EXISTS (
4+
SELECT 1 FROM pg_indexes
5+
WHERE indexname = 'idx_input_tx_out_spent_block'
6+
AND tablename = 'tx_input'
7+
AND schemaname = current_schema()
8+
) THEN
9+
CREATE INDEX idx_input_tx_out_spent_block ON tx_input (tx_hash, output_index, spent_at_block);
10+
END IF;
11+
END $$;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DO $$
2+
BEGIN
3+
IF NOT EXISTS (
4+
SELECT 1 FROM pg_indexes
5+
WHERE indexname = 'idx_address_utxo_owner_addr_block'
6+
AND tablename = 'address_utxo'
7+
AND schemaname = current_schema()
8+
) THEN
9+
CREATE INDEX idx_address_utxo_owner_addr_block ON address_utxo (owner_addr, block);
10+
END IF;
11+
END $$;

0 commit comments

Comments
 (0)