balances_<chain>.daily_updates is the default table for historical balance analysis. It is sparse: one row is written per (address, token_address) balance change, not one row per day per pair. Each row carries a validity interval [valid_from, valid_to) covering the days during which that balance was held. Adjacent intervals share the boundary day on valid_from / valid_to (no gap, no overlap). Refreshed hourly.
The interval layout lets you reconstruct the balance for any (address, token_address) on any past day by selecting the row where valid_from <= day < valid_to. To get per-day rows across a window, expand the interval against a calendar table (see Example Queries).
valid_to = '9999-12-31' marks the active (ongoing) interval. USD value is joined from prices.day at valid_from. Zero-balance periods are kept as their own intervals, so filter balance > 0 if you want to exclude empty holdings.
Table Schema
Usage Notes
The table is partitioned byaddress_prefix, the first byte of address rendered as a 2-character lower-hex string ('00'..'ff'). For best performance, include all three of:
- A cohort filter on
addressand/ortoken_address. - A partition filter
address_prefix IN (...)matching the addresses in your cohort. For a hardcoded address the prefix is the first hex byte (e.g.0xd8dA…→'d8'). For a dynamic cohort, materialize the distinct prefixes in a subquery so the planner can prune partitions:address_prefix IN (SELECT DISTINCT lower(to_hex(varbinary_substring(address, 1, 1))) FROM <cohort>). - Day bounds on the interval:
valid_from <= <end_date> AND valid_to > <start_date>. These let the scanner skip files that fall outside the window. The active row (valid_to = '9999-12-31') is naturally included byvalid_to > <start_date>.
utils.days calendar table. For very large outputs (hundreds of millions of rows), CROSS JOIN UNNEST(sequence(...)) clips the day sequence at generation time and is typically faster.
Example Queries
Daily USDC balance for a wallet, last 30 days:cex.addresses, a curated table of known centralized-exchange wallets. The same pattern works for any cohort table or uploaded address list.