USE KEYS and Key value Operation


I am trying to query for a list of document IDs, does USE KEYS perform similar to KEY VALUE operation? Is there any other options to get documents for a given list of document IDs?

Thank you!

As you already know document keys and don’t need further processing ( Filter, Aggregates, JOIN) then KEY VALUE is perform better(One HOP KV to client, Can be done asynchronous, parallel). USE KEYS (must do two HOP’s (KV ===> Query Service ===> Client), statement prepare/plan even though negligible).

@vsr1, thank you for the clear explanation. :+1:t2:

Just curious, so if I have list of Document Keys or single a Document Key and have further filtering( example, I have a list of Student keys, and I want only the ones that have joinedDate< a certain date) , USE KEY is the best option to use?

If you have document keys any filters you want using KEY VALUE all logic needs to be done in application after document retrieved.

If you use SQL ( including USE KEYS, no USE KEYS then it uses index) query service apply the filter and return you results.

You can decide which one to use

1 Like