-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Avoid streaming entire IDB tables #486
Comments
Yep, this makes sense. @Valentine1898 perhaps you can pick this up when you're next available? Thinking you may be a good candidate for this as it may impact the testing tracking issue you are working on? #333 |
Yeah, sure, I'll start that today |
We have only a few streaming queries at the moment
Based on this, only |
@Valentine1898 think we can close this issue? |
Missed the comment, I think yes |
After #312 and #481 we are now iterating over streamed queries, instead of loading the entire query into memory
This is an improvement but could still get better. Inspecting and filtering items in the table should, as much as possible, be done by the database, not the caller. IDB can handle more specific queries, if we prepare index by an object's attribute.
For example, in transaction-info.ts,
web/packages/router/src/grpc/view-protocol-server/transaction-info.ts
Lines 8 to 14 in f866ef4
Which is backed by our idb query helper iterateTransactionInfo,
web/packages/storage/src/indexed-db/index.ts
Lines 187 to 198 in 8e13b82
We could instead query a key range, if we prepared the schema to index transactions by height, the way we index swaps, notes, &c by index
web/packages/storage/src/indexed-db/index.ts
Line 74 in f866ef4
would become
with schema
and expose the index appropriately through our queriers
which would greatly simplify transaction-info.ts
this technique could be applied generally through most of our full-table idb methods.
some situations involving compound indicies can be handled, but idb does not have good support for complex compound indicies. things like assets.ts with multiple fields
web/packages/router/src/grpc/view-protocol-server/assets.ts
Lines 19 to 52 in f866ef4
would not be easy to provide indexes for. you can see more detail on this subject
The text was updated successfully, but these errors were encountered: