-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Non-linear search for payment credentials by introducing virtual indices #58
Comments
I like the idea 🤨. I am curious to see how this affects the behavior of indexes. |
Findings from playing around with this:
Real query takes 5 ms. |
Note that virtual columns also support more complex generators such as |
|
Looking into this ☝️, actually I kept the column as it was an simply added the virtual column with a With an index on the column and... well: Before
After
This being the busiest address on the testnet (125k entries). Neat. |
Describe your idea, in simple words.
Currently, search the UTxO set for UTxOs by payment credential is slow (~2s on 3GB of data) due to it being performed as linear search by sqlite. We can improve on that.
Currently kupo serializes addresses internally like this
which makes total sense if we only want to leverage SQLite indices for delegation credentials.
We can actually leverage sqlite indices even better and achieve better search performance on both payment and stake credentials like this:
address_delegation_credentials
assubstr(address, 60)
address_delegation_credentials
address_delegation_credentials = ?
instead of a LIKE comparisonNote: we could even add a virtual column that only contains the payment credentials and add an index on that too.
Why is it a good idea?
In the case that users want to query the UTxO set by payment credentials this is useful. I know of at least two handy use cases of this.
This will dramatically speed up queries in this use case.
This also avoid the issue of memory duplication in #57 (the size of kupo.sqlite3 with this index after vacuum is 2.7GB vs 2.4GB. timings for queries TBD)
Are you willing to work on it yourself?
Yes
The text was updated successfully, but these errors were encountered: