Poor Performance of N1QL

These are the latencies on making 100 queries with a single where clause on an indexed field.

“select * from default where vendorCode=‘100’ limit 10”

Total Requests: 100 (values in millis)
50.0: 1378
70.0: 1437
80.0: 1461
90.0: 1502
95.0: 1588
99.0: 1694
99.5: 1701
99.9: 1701
100.0: 1701

Can somebody please explain me why the queries are this slow.

As of this writing, N1QL is in developer preview and the performance you see at the moment is not representative of where it should be at general availability. The preview is mostly intended to show the flexibility and functionality of the language and gain feedback from users at the functional level.

Thanks!

Hi Sumit,

One specific issue in DP3 is that the LIMIT clause is not applied early enough in the execution pipeline. So you may be seeing latencies based on vendorCode=‘100’, and not based on LIMIT 10. This specific issue will be fixed in the next preview release.

Hi Sumit. Please see http://blog.couchbase.com/n1ql-dp4-is-here

Thanks Gerald, I will run the tests again and post the results here. Apart from the features mentioned in the post, is these any doc where the performance improvements are listed? Have you guys implemented disk based sorting yet?

Sumit, per our plan, we have completed the language features with DP4 and are now turning to performance testing. if you follow @N1QL, we will post announcements there.

I’m not yet sure if we will have disk-based sorting for v1, but we are exploring it. I’ve create a ticket to track it: https://issues.couchbase.com/browse/MB-13085