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

KV Secondary Indexes can reference Primary Keys #139

Open
mgenereu opened this issue Sep 24, 2023 · 1 comment
Open

KV Secondary Indexes can reference Primary Keys #139

mgenereu opened this issue Sep 24, 2023 · 1 comment

Comments

@mgenereu
Copy link
Contributor

The current documentation recommends double storing the value of a KvEntry on the creation of a secondary index. Double storing values requires significant storage and significant effort from the developer to ensure synchronization of all values on all updates. While researching other Deno Deploy documentation, I came across this Denoland blog entry by @lambtron and it makes a completely different recommendation of storing the primary key as the value instead of the actual value. While there's still some onius on the developer to maintain the integrity of the secondary index and using the secondary index is a double lookup, there's no longer multiple copies of the data being stored or multiple transactions when the secondary index is unchanged. I would like to recommend the current documentation be updated to use primary keys for secondary indices or at least make the suggestion as an exercise for the reader to research. Please let me know how I can help if either suggestion is determined to have value.

@mgenereu
Copy link
Contributor Author

A fellow developer pointed out that with four secondary indexes, five copies would be stored!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants