Mick
KV - Not possible to maintain in real world?
I have a question regarding Deno KV: I just checked the docs and it seems straight forward so far BUT since it is not possible to query for values or let the DB itself create secondary indexes I wonder how the real world workflow could look like?
- If I want to query a single value of a huge object, I need to retrieve the full object if I didnt save them as secondary indexes before.
- If I want to query for a specific value of a huge object efficiently, I need to create secondary indexes. But what if I need a new query for a new feature that I develop? Now I need to create new secondary indexes for all existing values before I can do this query? At what point in my application should I add them? On startup? Or should I write a migration script each time I want to add a new query?
- What if I have 1 million users and I have implemented a findByMail() function by creating secondary indexes for all million users, but one day I dont need the findByMail() function anymore. Now I have 2 million database entries from which 1 million are unused. At what point in my application do I delete them? On startup? I need a migration script each time I want to remove a new query?
- How do I perform operations like "Get all users with age greater 21"? I might add another secondary index for the age but then the .get() function does not have the option to perform this filter on the database side.
For example if I think about DynamoDB, which is also a kv storage, I know that when I define a secondary index the database will handle it for me and I dont have to create them myself and keep them updated. Also I can query for specific fields and filter the results. Is this minimalism of Deno KV by design or is this just too early to ask for those things? If it is by design then I feel like Deno KV needs another layer to automate secondary index handling and allow for querying and filtering. If these things are coming, is there any ETA?
27 replies