MostlyData_Solana CU - Forbidden Region
    Updated 2025-02-03
    /*
    https://solana.com/it/developers/guides/advanced/how-to-optimize-compute

    Solana has a max of 48000000 units per block

    */
    with date_filter as (
    select
    case
    when '{{n_days}}' != 0 then current_date() - interval '{{n_days}} days'
    else cast('{{start_date}}' as timestamp)
    end as start_date,
    case
    when '{{n_days}}' != 0 then current_date()
    else cast('{{end_date}}' as timestamp)
    end as end_date
    )

    ,compute_unit_data_raw as(
    select
    date_trunc('hour', block_timestamp) as dt,
    block_id,
    sum(units_consumed) as cu,
    sum(units_consumed) / 48000000 * 100 as share_of_max_cu
    from solana.core.fact_transactions ft
    join date_filter df
    on ft.block_timestamp between df.start_date and df.end_date
    group by 1,2
    )

    ,validator_data as(
    select
    distinct node_pubkey,
    vote_pubkey,
    QueryRunArchived: QueryRun has been archived