To test out N1QL vs. Views I updated one of our data analytics ruby scripts to N1QL to run some benchmarks. This script makes about 15k lookups for individual documents (using .get in the views version and select * use keys in n1ql) and then about 7k selects that return between 0-500 documents each. Also, the cb instance is offline while running the scripts (that is, nothing is being added to the db, so the indexes aren’t being rebuilt). I’m using 4.5.0-2601 Community Edition (build-2601) running on a development laptop.
When I run it with views, it takes roughly 30 seconds. When I run it with n1ql, it takes roughly 45. The standard deviation is much higher with n1ql than with views as well.
It’s not clear at this point where exactly the slowdown comes, but before I go diving in, is this what I should expect or should I be seeing faster times with n1ql?
@james which Ruby SDK are you using? Note that at the moment, there is no official Couchbase SDK for Ruby. @avsej used to maintain the 1.x, which went end-of-life in 2016. Adding support for prepared statements shouldn’t be too difficult to whichever one you’re using, but that’s not something we directly build/maintain. We can probably help if you need it though.
I’m doing these tests with 1.3.14. We’ve been using 1.3.13 in production for a couple of years now with no problems (using views). If we had more resources, we’d offer to help spruce it up, but we’re pretty strapped right now. I’ve heard rumors of a 2.0 sdk that we would be very happy to see…