USE KEYS limitations

I couldn’t find any documentation around recommended limit on the number of keys in the ‘USE KEYS’ clause for N1QL.

For example, would putting 1000 keys into this clause cause issues?

Hi, Yes. You can put 1000s keys in the USE KEYS clause either directly giving the keys, or using an expression.

In addition to what @keshav_m said, you can use a parameter with USE KEYS and then pass in the actual keys from your application. So you have several options.

Thanks for the replies!

I was asking because we were considering using N1QL to access our documents with SQL features (like group bys, filters, etc), but we didn’t want the overhead of going through the index service.

Just to be 100% sure - is EXPLICITLY passing 1000+ Key values in a single query going to be an issue?

Passing 1000+ keys is not an issue. There is a setting for max request size that may need to be changed from the default.

1 Like