Skip to content

optimize execution db queries#589

Merged
pk910 merged 2 commits intomasterfrom
pk910/optimize-execution-db-queries
Feb 23, 2026
Merged

optimize execution db queries#589
pk910 merged 2 commits intomasterfrom
pk910/optimize-execution-db-queries

Conversation

@pk910
Copy link
Copy Markdown
Member

@pk910 pk910 commented Feb 23, 2026

Summary

Optimize address page and transaction detail page DB queries that previously took 5-30+ seconds down to sub-10ms.

Address page

Fixed queries not using existing composite indexes, causing full sequential scans on tables with millions of rows.

Results (account with 3.4M incoming transactions):

Query Before After Improvement
Combined transactions 3,600ms 2.5ms 1,440x
Token transfers 10,557ms 2.9ms 3,640x
Internal transactions 24,222ms 0.7ms 34,600x

Transaction detail page

  • Added missing tx_hash indexes on el_event_index and el_transactions_internal
  • Use lightweight COUNT queries for tab badge counts instead of loading all rows
  • Load events/internal txs from blockdb when available, skip DB entirely
  • Only query full row data for the active tab

Results (transaction with 9,866 internal calls):

Query Before After Improvement
Event count 4,589ms 0.1ms 45,890x
Internal tx count 7,513ms 2.3ms 3,270x
Event full load (fallback) 4,589ms 0.05ms 91,780x
Internal tx full load (fallback) 7,513ms 8ms 939x

When blockdb has the data (normal case), DB full-load queries are skipped entirely.

@pk910 pk910 merged commit 46f97c7 into master Feb 23, 2026
2 checks passed
@pk910 pk910 deleted the pk910/optimize-execution-db-queries branch February 23, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants