with tx as (
select
date_trunc('day', block_timestamp) as block_day,
fee[0]:amount/1e6 as largest,
gas_used,
gas_wanted,
ROW_NUMBER() over (partition by block_day order by largest desc) as rank
from terra.transactions
where tx_status = 'SUCCEEDED'
and block_timestamp >= CURRENT_DATE - 30
and fee[0]:denom::string = 'uusd'
)
select * from tx
where rank = 1