Skip to content
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

Projection Support #366

Closed
stefanhaustein opened this issue Oct 14, 2021 · 2 comments
Closed

Projection Support #366

stefanhaustein opened this issue Oct 14, 2021 · 2 comments
Labels
feature request TPAC2024 Topic for discussion at TPAC 2024

Comments

@stefanhaustein
Copy link

We have some tables that contain columns that can be relatively large, but these large columns aren't actually needed in many or our queries. Of course, we could split the tables, but this isn't desirable due to the additional management overhead and deviation from the expected / "natural" schema.

API Proposal

request = store.getAllProjection(keyPath, query [, count])
request = index.getAllProjection(keyPath, query [, count])

Retrieves partial data as specified by keyPath (as specified in section 2.5 of the IndexedDB spec) for the records matching the given key or key range in query (up to count if given).

This should enable significant performance gains at least in the case where keyPath can be satisfied from an index.

To my understanding, there is currently no way to obtain the index "content" by any other means (other than using cursors or fetching the full rows).

@asutherland
Copy link
Collaborator

I conceptually like this as a user of IDB, but with my (Firefox) implementer hat on, it's not clear that this could be specified or implemented in a way that would provide meaningful performance increases in a post-Spectre world. At least not without requiring massive increases in implementation complexity for browsers.

Right now I think it's preferable that more advanced use-cases like this be implemented in content, possibly using WASM, on top of existing/future block-storage APIs. The smaller API and implementation surface is better suited for cross-browser support in potentially new engines, while also being more likely to have consistent performance characteristics across browsers.

Structured Serialization Representation Limitations

The IDB data-model currently stores the values as largely opaque structured serialization blobs. Key paths are evaluated in the IDB-using global at add/update time before they go async when they're sent to whatever the underlying storage implementation is (frequently via IPC). The only case where IDB notionally evaluates key paths anywhere else is during index creation where existing values need to have their key paths extracted, which fundamentally requires the implementation to either spin up something that looks like a content global to load every value and extract key paths, or reuse the active upgrade transaction's global/etc.

@SteveBeckerMSFT SteveBeckerMSFT added the TPAC2024 Topic for discussion at TPAC 2024 label Sep 9, 2024
@SteveBeckerMSFT
Copy link
Contributor

SteveBeckerMSFT commented Oct 1, 2024

TPAC 2024: We discussed and agreed with @asutherland comment above. Closing because of implementation challenges that would prevent any performance gains.

I created a new issue to see if getAllIndexKeys() could help in scenarios like this where we may want the index keys, but not the full value.

@SteveBeckerMSFT SteveBeckerMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request TPAC2024 Topic for discussion at TPAC 2024
Projects
None yet
Development

No branches or pull requests

4 participants