MostlyData_CDF gas usage with block filter
    Updated 2024-12-04
    -- forked from PDF gas usage with block filter @ https://flipsidecrypto.xyz/studio/queries/7f28040f-8239-43f2-ae86-2bdf782f5af4

    with block_info as(
    select
    block_number
    ,tx_count
    ,gas_used
    ,block_header_json['baseFeePerGas'] as baseFeePerGas

    from ethereum.core.fact_blocks

    where
    block_timestamp >= current_date() - interval '{{n_days}} days'
    and gas_used < 16000000
    and gas_used > 15000000
    )

    ,filtered_txs as(
    select
    tx.gas_used,
    tx.position,
    case
    when tx.position between 0 and 10 then 'Tier1'
    when tx.position between 11 and 50 then 'Tier2'
    else 'Tier3'
    end as position_group

    from ethereum.core.fact_transactions tx
    inner join block_info b on tx.block_number = b.block_number

    )

    ,group_data as(
    select
    position_group,
    cast(
    QueryRunArchived: QueryRun has been archived