Querying Market SQL
How a Market SQL request works — choosing a dataset, writing the query, and choosing how results are returned.
A Market SQL request describes three things:
the dataset to query,
the SQL statement to run,
and the format the results should be returned in.
This page explains those three choices. For the endpoint, parameters, limits, and the full table catalog, see the API Reference.
1. The dataset
The database parameter selects the dataset. Your API key must have an active trial or subscription for that dataset.
2. The query
The request body is a single, read-only SQL statement written in ClickHouse SQL. You can filter with WHERE, aggregate with GROUP BY, sort, limit, and join tables within the same dataset.
SELECT block_time, direction, base_token, quote_token
FROM pumpswap_all_swaps
LIMIT 5;Because filtering, aggregation, and joins run server-side, you receive only the rows your question needs rather than downloading raw records and processing them locally.
Execution limits
Every query runs within the execution limit of your access plan:
Free trial
1
10 seconds
24-hour trial
1
10 seconds
Monthly
Higher query limits
60 seconds
Custom
Custom query capacity
Custom
3. The result format
The default_format parameter sets how rows are returned. All examples in this documentation use JSONEachRow, which returns one JSON object per line:
A FORMAT clause at the end of the SQL statement takes precedence over default_format. The official ClickHouse clients set the format for you: @clickhouse/client through its format option, and clickhouse-connect through methods such as query_df.
Next steps
API Reference — endpoint, authentication, parameters, and every table
Getting Started — activating a dataset and running a first query
Dashboard — browse datasets and tables before you query
Last updated
Was this helpful?