N1QL Inconsistent results

@aaronmell

I do know that there is a delay before indexes are updated after you modify data. It’s not like SQL, which is an atomic, transacted process. That’s probably why you aren’t noticing the problem in debug mode, since stepping through is slowing your read down.

If you are performing the query using IQueryRequest (instead of a string), then you have some options that control this consistency. The cost is that it can delay the query result. See the ScanConsistency, ScanVector, and ScanWait methods.

For example, ScanConsistency of RequestPlus will require that all statements up to the moment you run the query must be posted to the index. You can use ScanWait to put a timeout on this update.

1 Like