Update balances for holders#247
Open
DenisCarriere wants to merge 2 commits intomainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates
ReplacingMergeTree(block_num, is_deleted)block_hash EPHEMERALREFRESH AFTER 60 MINUTEfor*_holdersMV'sContext
This pull request updates the ClickHouse schema for ERC-20 and native token balances to improve deduplication, enable efficient deletion tracking, and add materialized views for quickly accessing top token holders. The main changes are the introduction of an
is_deletedcolumn for soft deletion, adjustments to the table engines to support this, and the creation of materialized views for top holders.Schema enhancements for soft deletion and deduplication:
is_deletedcolumn (materialized asbalance = 0) to botherc20_balancesandnative_balancestables, enabling efficient tracking of deleted balances. [1] [2]ReplacingMergeTreewith the newis_deletedcolumn as the versioning parameter, improving deduplication and deletion handling. [1] [2]block_hashcolumn asEPHEMERALin both tables to optimize storage for transient data. [1] [2]Materialized views for top holders:
erc20_balances_holdersto track the top 10,000 ERC-20 token holders per contract, refreshing every 60 minutes for up-to-date rankings.native_balances_holdersto track the top 100,000 native token holders, also refreshing every 60 minutes.