messarisol_priority_fees_with_ComputeBudget copy
    Updated 2023-10-01
    -- forked from LTirrell / sol_priority_fees_with_ComputeBudget @ https://flipsidecrypto.xyz/LTirrell/q/R0OoTy3YYpPw/sol_priority_fees_with_computebudget

    WITH DailyCounts AS (
    SELECT
    DATE(block_timestamp) AS transaction_date,
    COUNT(DISTINCT CASE WHEN regexp_count(array_to_string(instructions, ','), 'ComputeBudget111111111111111111111111111111') = 2 THEN tx_id ELSE NULL END) AS priority_fee_tx_count,
    COUNT(DISTINCT tx_id) AS total_tx_count
    FROM
    solana.core.fact_transactions
    WHERE
    block_timestamp::date >= '2023-01-01'
    GROUP BY
    DATE(block_timestamp)
    )

    SELECT
    transaction_date,
    priority_fee_tx_count,
    total_tx_count,
    (priority_fee_tx_count * 100.0) / total_tx_count AS priority_fee_percentage
    FROM
    DailyCounts
    ORDER BY
    transaction_date
    Run a query to Download Data