KARTODPolygon - Gas Price, Gas limit, Gas used
    Updated 2023-09-16

    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as time,
    'Ethereum' AS chain,
    AVG(gas_price/1e9) as avg_gas_price,
    max(gas_price/1e9) as max_fee_price_max
    FROM ethereum.core.fact_transactions
    WHERE BLOCK_TIMESTAMP >= date_trunc('day', CURRENT_DATE()) - interval '90 days'
    GROUP BY time

    UNION ALL
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as time,
    'Polygon' AS chain,
    AVG(gas_price/1e9) as avg_gas_price,
    max(gas_price/1e9) as max_fee_price_max
    FROM polygon.core.fact_transactions
    WHERE BLOCK_TIMESTAMP >= date_trunc('day', CURRENT_DATE()) - interval '90 days'
    GROUP BY time

    UNION ALL
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as time,
    'Optimism' AS chain,
    AVG(gas_price/1e9) as avg_gas_price,
    max(gas_price/1e9) as max_fee_price_max
    FROM optimism.core.fact_transactions
    WHERE BLOCK_TIMESTAMP >= date_trunc('day', CURRENT_DATE()) - interval '90 days'
    GROUP BY time

    UNION ALL
    SELECT
    date_trunc('day', BLOCK_TIMESTAMP) as time,
    Run a query to Download Data