kodadot / loligo

Common good repository for Squid indexers in KodaDot
2 stars 1 forks source link

Holders tab freezes #32

Open vikiival opened 1 year ago

vikiival commented 1 year ago

On a huge collection

app freezes when you click on holders

Screenshot 2023-07-07 at 14 53 38
vikiival commented 1 year ago

a bit of tinkering over Ku*

select
       ne.current_owner,
       count(ne.current_owner),
       SUM(e.meta::bigint / 1e12) FILTER (WHERE e.caller = ne.current_owner) AS bought,
       SUM(e.meta::bigint / 1e12) FILTER (WHERE e.current_owner = ne.current_owner) AS sold,
       max(e.timestamp)::date as updated
from nft_entity ne
left join event e on ne.id = e.nft_id and e.interaction = 'BUY'
where collection_id = '7e982817a2d2575031-C6N4I' group by ne.current_owner order by count(*) desc;
vikiival commented 1 year ago

If it fixes freezing let's go

daiagi commented 1 year ago

If it fixes freezing let's go

Also need to address flippers. When we have both can stop querying the entire collection event history => fix freezing

I'll have pr for that very soon