with list as (select
distinct POOL_IDS ,
count(*)
from osmosis.core.fact_swaps
where block_timestamp::date >= '2022-05-01'
group by 1
order by 2 desc
limit 10 )
select block_timestamp::date as date ,POOL_IDS,
count(*)as n_transaction
from osmosis.core.fact_swaps
where block_timestamp::date >= '2022-05-01'
and POOL_IDS in (select POOL_IDS from list )
group by 1,2
order by 3 desc