Skip to main content

Overview

Every Chain Group in ChainStream GraphQL accepts two optional parameters that control which underlying tables are queried. These parameters let you optimize for freshness, query speed, or data completeness depending on your use case.

Dataset Parameter

The dataset parameter controls the time scope of the data being queried. It determines whether the query hits real-time tables, archive tables, or both.

Usage

Historical Data Backfilling

When building data pipelines or recovering from downtime, you can use dataset: archive with time-range filters to backfill historical data:
  1. Record the last processed timestamp or block height
  2. Query dataset: archive with a where filter from your last checkpoint to the current time
  3. Process the backfilled data
  4. Switch to dataset: realtime for ongoing monitoring

Tables Without Dataset Support

Some Cubes always query the same table regardless of the dataset value. These include:
  • DWS Cubes: TokenHolders, WalletTokenPnL, DEXPools — these represent current-state snapshots
  • Special tables: TransactionBalances, PredictionTrades, PredictionManagements, PredictionSettlements
For these Cubes, dataset is silently ignored.

Aggregates Parameter

The aggregates parameter controls whether the query uses pre-aggregated materialized views (DWM layer) instead of raw detail tables (DWD layer). Pre-aggregated tables contain pre-computed rollups (typically per-minute) that are significantly faster to query.

Usage

When to Use Each Mode


Combining Both Parameters

You can use dataset and aggregates together:
This query fetches the last ~60 minutes of cross-chain token trade statistics using real-time data with pre-aggregated tables for maximum speed.

Performance Considerations

Use realtime for dashboards

dataset: realtime queries a smaller table partition, resulting in faster response times for monitoring use cases.

Use aggregates for analytics

aggregates: yes or only leverages pre-computed rollups that are orders of magnitude faster than scanning raw event tables.
For the fastest possible OHLC or volume queries, combine dataset: realtime with aggregates: only. This targets the smallest, most optimized data slice.

Schema Overview

See how dataset and aggregates fit into the overall query structure.

Data Cubes

Check which Cubes support dataset switching.