MostlyData_PDF gas usage with block filter
    Updated 2024-12-04
    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
    and tx_count > 196
    )

    ,filtered_txs as(
    select
    tx.gas_used,
    tx.position,
    case
    when tx.position between 0 and 10 then 'T_0_10'
    when tx.position between 11 and 50 then 'T_11_50'
    else 'T_50_plus'
    end as position_group

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

    /*
    where
    tx.gas_used > 0
    and tx.gas_used < 200000
    */
    )

    QueryRunArchived: QueryRun has been archived