Hey I am trying to see if I can run a sub doc lookup via a java implementation that can look at multiple sub paths at once and tell me all the array lengths of each path. I know I can do this with n1ql as such:
X) FROM BUCKET USE KEYS [“SOME::SUB::DOC”];
But is their a way to do the same thing via the subdoc api?
Thanks in advance
It’s not documented for some reason - sorry about that! - but there is indeed a way to do this:
I tried this in the java code and it seems to be a lot slower than the N1ql query, is there a reason that is?
That shouldn’t be the case, as single key operations should always be faster than their N1QL equivalent. The request can go directly to the right KV node, there’s no query parsing to do, and it’s over the highly optimized memcached protocol.
How are you benchmarking the two? JMH is good for microbenchmarking as it tries to eliminate JVM warmup and GC as factors.
I was running the query/subdoc api requests locally through my local java app and saw that n1ql was faster. I didnt perform an actual test to test the two. Will try the changes again for the subdoc again