Skip to content

Query

Querying for blockchain data on Dune is powered by DuneSQL, a custom-built query engine designed for efficient analysis of blockchain data.

DuneSQL Features

DuneSQL offers several useful features for working with blockchain data:

  1. Blockchain varbinary data types: Designed for storing addresses, hashes, and other encoded data.
  2. Native support for uint256 and int256 data types: Ideal for handling large numbers commonly found in blockchain data, with built-in functions for ease of use.
  3. Columnar storage format Optimized for fast reads, this format organizes data in columns rather than rows, enabling quick access to single columns for aggregation or filtering.
  4. Querying a query: DuneSQL allows you to query a query, which is great for creating reusable queries, building up complex queries, and reusing queries as views.

Sunsetting Old Query Engines

We are sunsetting our old query engines, SparkSQL and PostgreSQL. Please find all information in the Migrating to DuneSQL section of our documentation.

Using DuneSQL

DuneSQL is our query engine for blockchain data. It is a fork of TrinoSQL, which is an open-source, distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.

We have created extensive documentation for DuneSQL, which you can find in the DuneSQL Reference section of our documentation. Here you will be able to find:

Writing efficient queries

An efficient query-writing process requires knowledge of how DuneSQL and data storage works.

Querying a query

DuneSQL allows you to query a query, which is great for creating reusable queries, building up complex queries, and reusing queries as views.

Resources and Support

For assistance with DuneSQL, consider the following resources:

Join our #dune-sql Discord channel to connect with our team and the community for help and support.

Feedback and Suggestions

We appreciate your feedback and suggestions for improvement. Please email us at dunesq[email protected] with any concerns or ideas for optimization.