Blockscout 6.0 Performance Updates

We're seeing some amazing early results with increased execution speed and database storage optimization in Blockscout 6.0.

New optimizations make Blockscout queries 78% faster

Since the release of Blockscout 6.0 we’ve been measuring various metrics to see how various optimizations are impacting performance.

So far, execution times are 🔥🔥 🔥 and db storage space is ⬆️ ⬆️ ⬆️.

Taken individually, each optimization results in a small gain. However, when you combine these small improvements together, overall performance is markedly increased.

Let’s dive into a few specifics!

Transaction Table Denormalization

Starting with 6.0 we’ve started the process of denormalizing tables to speed up queries. This process will continue over time, for this initial update we focused on the transaction table, adding new columns for block_timestamp and block_consensus. This update allows us to remove joins with the blocks table for up to 10 queries used by the indexing fetcher and APIs. 

🔥 Looking at Eth Goerli we see execution time for queries are 78% faster!

Blockscout transaction table optimization

API results

🔥 Load testing of API endpoints on ETH Sepolia are 20 - 40% faster for nearly all relevant queries.

API 1 before 6.0

Blockscout API 1 before 6.0

API1 after 6.0

Blockscout API 1 after 6.0

API2 before 6.0

Blockscout API 2 before 6.0

API2 after 6.0

Blockscout API 2 after 6.0

Finalized Token Balance Table Denormalization

We've been working towards this effort by adding several columns to the token balance table (token_type, address_token_balances, address_current_token_balances) but had not yet backfilled these columns. Starting from 6.0 we backfilled the data so to eliminate joins with the tokens table.

🔥 So far, we've seen an execution time increase of 71% for these queries!

Blockscout token balance table optimized by 71%

Event Logs Table Optimization

We made a few small tweaks to save big on storage!

  • Updated the column type for each of 4 event log topics from varchar(255), which is 64 bytes in length, to bytea, which is 32 bytes. This means for each 10M rows in the logs table, we saved 1.28Gb in space (10,000,000 * 4 * (64 - 32)b=1.28Gb).
  • We removed the type column, as this was related to the now deprecated OpenEthereum client.

Examples of storage savings include:

  • ⬆️ ETH Mainnet 2.4T -> 1.9T 21% savings
  • ⬆️ ETH Goerli 721G -> 550G 24% savings
  • ⬆️ Gnosis Chain 1.7T -> 1.5T 12% savings

Additional Table Optimizations

  • Remove unused indexes on the current token balances table. We found indexes which were not being used by any queries or users and removed them.
    • ⬆️ Savings of up to 23% of space depending on the instance.
    • Example: ETH Mainnet data + indexes reduced from 226Gb to 172GB.
  • Dropped token_id column in the token_transfers table. This column was no longer needed due to previous migrations, and we were able to remove it along with the corresponding indexes. Savings = up to 8% on this table.
    • ⬆️ Savings of up to 8% of space on this table.
    • Example: ETH mainnet data + indexes reduced from 1.3T to 1.2T.
  • Create a multicolumn index for token_ids column queries. The token_ids column is always used in tandem with the token_contract_address_column, so it made sense to combine these into a multicolumn index.
    • 🔥 Boost in execution speed = 30%
Blockscout execution increased by 30%

🏆And the Winning Optimization is......

We added a column called refetch_needed to the index for the blocks table. This signals to the on-demand block/transaction re-fetcher that a re-fetch is needed. After adding this column, we saw a massive speed increase for these queries.

🔥 Execution speed 185,200 times faster!!!

Blockscout 6.0+

Blockscout 6.0 release represents a major milestone for Blockscout. We are excited to see some encouraging early results and will continue making incremental improvements in each minor release.

Blockscout news goes out to all MyAccount community users on supported chains. We would love to get your feedback on topics you'd like to see covered or any questions you have. Visit us on X or Discord to get your explorer questions answered or get your project added to our growing network list ⬇️