How do I change the "stale" setting for an N1qlQuery?


#1

I want the view to be fully indexed before results are retrieved, the equivalent of doing the following stale statement with a ViewQuery:

var q = ViewQuery.from('beer', 'by_name')
    .range(value, value + JSON.parse('"\u0FFF"'))
    .stale(ViewQuery.Update.BEFORE)
    .limit(ENTRIES_PER_PAGE);

but for an N1qlQuery.

How do I do this with a N1qlQuery?


#2

@neatcode from the Java SDK, there is currently no way to change the “stale” behavior for a N1QL query. This is something we will work through in the next months and for sure have a good solution once it ships together with the product.

For now you have to use the defaults that N1QL provide or fall back to Views.


#3

@daschl OK, thanks for the quick feedback. That’s what I suspected. BTW I’m using the Node SDK so I’d like to see support for stale settings in there.


#4

@neatcode, we have the existing flags - stale=false|after|ok in views. would it suffice for you to have those or which one would be your choice? would you want another flavor in couchbase?
thanks
-cihan


#5

@cihangirb

I’d want the flag described in my original post as Update.BEFORE (in current Node.js SDK for ViewQuery).

This looks similar to the flag stale=false which must be in some prior or other versions/SDKs.

– Austin


#6

thanks! would you be ok with a new level that would NOT update the indexes to the ‘time’ the was executed but to the ‘time’ that your last update happened on this connection? Essentially RYOW (read your own write)? if you have a few milliseconds between your last update and your query, this may reduce the latency of your query by quite a bit. would that be interesting in your case.
We are looking at new options and that is why I am poking at this. I’d appreciate your feedback.
thanks
-cihan