SQL has become the standard way to query Solana blockchain data. Whether you are tracking whale wallets, measuring DEX volume, or analyzing NFT sales trends, writing SQL against indexed Solana data gives you precision that no dashboard can match.
The problem is choosing the right platform. Dune Analytics, Helius, and Google BigQuery all offer SQL (or SQL-adjacent) access to Solana data today — Flipside Crypto's self-serve SQL platform, once a fourth option, was discontinued in 2026 (details below) — and the survivors differ in schema design, data freshness, pricing, and query speed. This guide walks through each platform with setup instructions and ready-to-use queries so you can start extracting insights immediately.
If you are new to on-chain data analysis, start with our introduction to Solana on-chain data before diving into SQL-specific workflows.
Why Query Solana Data with SQL
Dashboards are useful for monitoring known metrics, but SQL unlocks questions that no pre-built dashboard anticipates. You can filter by specific programs, time windows, wallet clusters, or token mints — and combine them in ways that surfaces alpha before it becomes common knowledge.
Common use cases for SQL on Solana:
- Identify the top holders of any SPL token at a specific point in time
- Calculate daily DEX volume broken down by protocol (Jupiter, Raydium, Orca)
- Track wallet profitability across hundreds of trades
- Analyze NFT sales history by collection, marketplace, or price range
- Monitor protocol-level metrics like TVL changes, fee revenue, and user retention
Every platform covered here indexes raw Solana transactions and decodes them into structured tables you can query with standard SQL syntax.
Dune Analytics
Dune Analytics is the most popular blockchain analytics platform with a massive community of analysts sharing public queries and dashboards. Its Solana support covers decoded program data, token transfers, DEX trades, and NFT events.
Setting Up Dune
- Create an account at dune.com
- Navigate to the query editor (New Query)
- Select "Solana" from the database dropdown
- Start writing SQL using DuneSQL syntax (Trino-based)
As of September 10, 2026, Dune's free tier is view-only — you can browse and fork existing dashboards and queries, but running your own SQL (the workflow this guide walks through) requires a paid plan. The cheapest option is the Analyst plan at $65/month (4,000 credits); the Plus plan ($349/month, 25,000 credits) adds private queries, faster execution, and CSV exports.
Dune Schema Overview
Dune organizes Solana data into several key schemas:
solana.transactions — All Solana transactions with fee, signer, and status data
solana.account_activity — Account balance changes per transaction
tokens_solana.transfers — Decoded SPL token transfers
dex_solana.trades — Aggregated DEX trades across all major Solana DEXs
nft_solana.trades — NFT marketplace sales data
Example: Daily DEX Volume on Solana
SELECT
date_trunc('day', block_time) AS trade_date,
project AS dex,
COUNT(*) AS trade_count,
SUM(amount_usd) AS volume_usd
FROM dex_solana.trades
WHERE block_time >= NOW() - INTERVAL '30' DAY
GROUP BY 1, 2
ORDER BY 1 DESC, 4 DESC
This query returns daily DEX volume per protocol over the last 30 days. You can filter by specific DEX names like 'jupiter' or 'raydium' to narrow results.
Example: Top Token Holders
SELECT
to AS wallet,
SUM(CASE WHEN to = wallet THEN amount ELSE 0 END)
- SUM(CASE WHEN "from" = wallet THEN amount ELSE 0 END) AS net_balance
FROM tokens_solana.transfers
WHERE token_mint_address = '{{token_mint}}'
GROUP BY 1
HAVING net_balance > 0
ORDER BY 2 DESC
LIMIT 100
Replace {{token_mint}} with any SPL token mint address. Dune supports parameterized queries, so you can create a reusable dashboard widget for any token.
Flipside Crypto
Flipside took a different approach by providing curated, pre-modeled data tables that were easier to query than raw transaction data, with Solana coverage spanning decoded program events, labelled wallet addresses, and clean swap tables.
Status update: Flipside's self-serve SQL platform (Flipspace) is no longer available. Flipside sold its blockchain data business to SonarX in May 2026, and flipsidecrypto.xyz now redirects to edisyl.com, Flipside's new enterprise AI venture. SonarX inherited Flipside's Solana dataset but serves it through institutional delivery (SOC 2, custom data pipelines) rather than a public sign-up-and-query web app, so there is no direct self-serve replacement for the workflow this section used to describe. If you were using Flipside for ad-hoc SQL analysis, Dune (paid tier) or Google BigQuery below are the closest remaining free/self-serve options.
The schema shape below is kept for reference, since Flipside-modeled tables are still the basis of the data SonarX now sells, but you can no longer run these queries yourself without an enterprise data agreement.
Flipside's Former Schema
Flipside's Solana tables were organized like this:
solana.core.fact_transactions — Transaction-level data with fees, signers, and success status
solana.core.fact_transfers — All SOL and SPL token transfers
solana.core.fact_events — Decoded program events
solana.defi.fact_swaps — DEX swap data with clean token symbols and USD values
solana.nft.fact_nft_sales — NFT marketplace transactions
solana.core.dim_labels — Known wallet labels (exchanges, protocols, whales)
Example: Wallet Profitability Analysis (illustrative — Flipside's self-serve editor is discontinued)
WITH buys AS (
SELECT
swapper AS wallet,
swap_to_mint AS token,
SUM(swap_to_amount) AS tokens_bought,
SUM(swap_from_amount * COALESCE(swap_from_decimal_price, 0)) AS cost_usd
FROM solana.defi.fact_swaps
WHERE swapper = '{{wallet_address}}'
AND block_timestamp >= CURRENT_DATE - 30
GROUP BY 1, 2
),
sells AS (
SELECT
swapper AS wallet,
swap_from_mint AS token,
SUM(swap_from_amount) AS tokens_sold,
SUM(swap_to_amount * COALESCE(swap_to_decimal_price, 0)) AS revenue_usd
FROM solana.defi.fact_swaps
WHERE swapper = '{{wallet_address}}'
AND block_timestamp >= CURRENT_DATE - 30
GROUP BY 1, 2
)
SELECT
b.token,
b.tokens_bought,
COALESCE(s.tokens_sold, 0) AS tokens_sold,
b.cost_usd,
COALESCE(s.revenue_usd, 0) AS revenue_usd,
COALESCE(s.revenue_usd, 0) - b.cost_usd AS pnl_usd
FROM buys b
LEFT JOIN sells s ON b.token = s.token
ORDER BY pnl_usd DESC
This query calculates profit and loss per token for a given wallet over the last 30 days. It pairs buy and sell activity to show which tokens were profitable — the pattern is worth understanding even though you can no longer run it against Flipside directly.
Helius DAS and SQL Access
Helius is primarily an RPC and API provider, but its Digital Asset Standard (DAS) API and enhanced transaction endpoints let you query Solana data programmatically. While Helius does not offer a traditional SQL editor, you can pipe its structured JSON responses into your own database for SQL analysis.
Setting Up Helius for Data Queries
- Sign up at helius.dev and get your API key
- Use the DAS API for asset and ownership queries
- Use Enhanced Transaction API for decoded transaction history
- Load results into a local PostgreSQL or SQLite database for SQL analysis
The free tier provides 1,000,000 credits/month. For heavy data analysis, the Business plan ($499/month) offers higher limits and priority access.
Example: Query Top Holders via DAS API
// Fetch top holders for a token mint using Helius DAS
const response = await fetch(
`https://mainnet.helius-rpc.com/?api-key=${API_KEY}`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getTokenAccounts",
params: {
mint: "TOKEN_MINT_ADDRESS",
limit: 100,
options: { showZeroBalance: false }
}
})
}
);
Once you load this data into a local database, you can run standard SQL queries against it. This approach is best when you need real-time data that analytics platforms might lag behind on.
Example: NFT Sales History via Enhanced Transactions
// Fetch NFT transaction history
const response = await fetch(
`https://api.helius.xyz/v0/addresses/${NFT_MINT}/transactions?api-key=${API_KEY}&type=NFT_SALE`
);
const sales = await response.json();
// Insert into local DB for SQL analysis
Helius is ideal when you need the freshest data possible or when your analysis requires combining on-chain data with off-chain sources in a custom database.