-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL Materialized view for NFT collection stats #1
Comments
Here are some ideas for improvement I can think of on a quick look:
Looking forward to getting the indexer open-sourced btw :) |
Thanks for your input @georgeroman. I omitted some details to keep the discussion focused on the materialized view
I agree but working with
This could be a really interesting optimization. Would we achieve this with a trigger on the nft_transfer insert? or are there any other way to do it?
Thank you, will do!
We have already some indexes for eg:
Would you recommend spending time cleaning them with more advanced specifications? Was actually watching Reservoir protocol for us to power a marketplace as it was recommended to us by Bailey from Defiance ;) |
I think the storage gains you get would be worthwhile (using SELECT '0x' || encode('\xea674fdde714fd979de3edf0f56aa9716b898ec8'::bytea, 'hex');
Having triggers is probably the easiest way to do it. Although there are more efficient ways of doing it (eg.
Yes, I would remove all indexes that are not actually used and replace them with ones that fit the current queries. Indexes slow down writes so not worthwhile keeping anything not being used. You can always just create them on-demand as they are needed.
Nice, would be glad to help if you need any assistance :) |
This materialized view goal's is to sum up NFT collection stats based on their on-chain activity (number of total transfers/transfer last day/hour and number of owners). The view is based on the 3 following tables:
We currently have a Materialized view that does this that is lacking optimization:
We are looking for someone able to rewrite this query in a more optimized way first. A second step would be to add information about trade/price as you can see that the
nft_transfer
table containstrade_price
so we could compute the floor price during the last and current hour/day.Comment here if you're interested in this issue and how you'd start.
The text was updated successfully, but these errors were encountered: