Query editor
with collect_data as (select call_block_time,JSON_VALUE(vars, 'lax $.collector') as collector,JSON_VALUE(vars, 'lax $.profileId') as profile_id,JSON_VALUE(vars, 'lax $.pubId') as publication_id,JSON_VALUE(vars, 'lax $.profileId') || '-' || JSON_VALUE(vars, 'lax $.pubId') as unique_publication_id,output_0 as collection_idfrom lens_polygon.LensHub_call_collectWithSigwhere call_success = trueunion allselect call_block_time,-- t.`from` as collector,-- c.profileId as profile_id,-- c.pubId as publication_id,-- c.profileId || '-' || c.pubId as unique_publication_id,CAST(t."from" AS VARCHAR) as collector,CAST(c.profileId AS VARCHAR) as profile_id,CAST(c.pubId AS VARCHAR) as publication_id,CAST(c.profileId AS VARCHAR) || '-' || CAST(c.pubId AS VARCHAR) as unique_publication_id,c.output_0 as collection_idfrom lens_polygon.LensHub_call_collect cinner join polygon.transactions t on c.call_tx_hash = t.hashwhere call_block_time >= CAST('2022-05-18' AS TIMESTAMP) -- Lens launch dateand block_time >= CAST('2022-05-18' AS TIMESTAMP)and c.call_success = true),collects_summary as (select count(*) as total_collect_countfrom collect_data),top_collected_publications as (select profile_id,publication_id,unique_publication_id,count(*) as collect_countfrom collect_datagroup by 1, 2, 3order by 4 desclimit 500)select profile_id,publication_id,unique_publication_id,collect_count,sum(collect_count) over () as top_publication_collect_count,total_collect_count,(sum(collect_count) over ()) * 1.0000000000000000 / total_collect_count * 100 as top_publication_collects_ratiofrom top_collected_publicationsinner join collects_summary on trueorder by 4 desc