Skip to main content
The solana_utils.daily_balances table provides end-of-day balance snapshots for every address on Solana, covering both native SOL and SPL token holdings. This table is the historical counterpart to solana_utils.latest_balances. Each row represents the balance for a specific address, token, and day. The table is partitioned by month for query performance and is sourced from solana.account_activity.

When to Use This Table

  • Track historical balance changes for a wallet over time
  • Analyze token holder distribution trends
  • Build time-series portfolio valuation charts
  • Monitor treasury balances for Solana DAOs and protocols

Query Performance

Partition key: month Always include a time filter (day range) and filter on address or token_mint_address for best performance.
-- ✅ Good: specific address + time range
SELECT *
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND day >= DATE '2025-01-01'

-- ❌ Slow: no time or address filter
SELECT * FROM solana_utils.daily_balances
WHERE token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'

Table Schema

ColumnTypeDescription
dayTIMESTAMPDay of the balance snapshot
monthDATEMonth partition key
addressVARCHARSolana wallet address
sol_balanceDOUBLENative SOL balance at end of day
token_mint_addressVARCHARMint address of the SPL token
token_balanceDECIMAL(38,18)SPL token balance in display units
token_balance_ownerVARCHAROwner of the token balance
block_timeTIMESTAMPBlock time of the last balance change
block_slotBIGINTBlock slot of the last balance change
unique_address_keyVARCHARUnique key for address + token combination
updated_atTIMESTAMPWhen this record was last updated

Table Sample

Example Queries

Daily SOL balance for a wallet over the last 30 days:
SELECT
  day,
  sol_balance,
  token_balance,
  token_mint_address
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND day >= NOW() - INTERVAL '30' DAY
ORDER BY day DESC
Track USDC balance history for an address:
SELECT
  day,
  token_balance
FROM solana_utils.daily_balances
WHERE address = 'FG4Y3yX4AAchp1HvNZ7LfzFTewF2f6nDoMDCohTFrdpk'
  AND token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' -- USDC
  AND day >= DATE '2025-01-01'
ORDER BY day