Skip to content

fix: improve performance on /account/balance for addresses with large transactions count (low effort improvements) #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ Further adjustments can be made by changing `.env.docker-compose` file. For more

---
Thanks for visiting us and enjoy :heart:!

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_indexes
WHERE indexname = 'idx_input_tx_out_spent_block'
AND tablename = 'tx_input'
AND schemaname = current_schema()
) THEN
CREATE INDEX idx_input_tx_out_spent_block ON tx_input (tx_hash, output_index, spent_at_block);
END IF;
END $$;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_indexes
WHERE indexname = 'idx_address_utxo_owner_addr_block'
AND tablename = 'address_utxo'
AND schemaname = current_schema()
) THEN
CREATE INDEX idx_address_utxo_owner_addr_block ON address_utxo (owner_addr, block);
END IF;
END $$;