Use Index Hint - not supported for UPDATE nor DELETE


Seems like USE INDEX (as an alternative to USE KEYS) could be very useful for an UPDATE or DELETE call. It’s supported for SELECT.


USE INDEX is hint. You still need predicate and it will validate the index so that no wrong results are possible. UPDATE/DELETE have option.

create index ix1 on default(type);
update default use index(ix1) set name ="abc" WHERE type IS NOT NULL;
delete FROM default use index(ix1) WHERE type IS NOT NULL;


Not according to the documentation (nor SDK - DeleteUsePath / UpdateUsePath):

For SELECT, AsPath is used (which extends HintPath which KeysPath, which permits both)


We will fix the documentation cc @guy.klages


Not supported in SDK’s either, unless that’s coming with new revisions?


N1QL documentation DOC-3475 .
@ingenthr will be able to answer for SDKs


Using the SDK, it seems we can’t apply 2 of these…

AsPath.useIndex() and AsPath.useKeys() return LetPath so they can’t be piled on top of eachother in the builder… By hacking around, they can’t be done outside the builder either - last one wins…


We’ll check that out. If we’ve missed something in the builder, there is always a lowest-common-denominator path of string. Updates coming.