Always be Prepared….

In our last discussion on prepared statements in couchbase we talked about the performance gains that are possible using prepared statements. I thought I'd post a “sequel” with a few real world examples and numbers using the included travel-sample dataset that ships with Couchbase.

A Simple Analysis

In the gist below, I used a simple control loop to simulate load against couchbase running on my laptop. I examined the performance of various queries: some with parameterization, different predicate strategies, joins, and a mixture of indexed and non indexed fields. The results are impressive, and proved to me there are substantial gains to be made by using prepared statements in most cases. We're still prisoners to the laws of physics when things like full primary index scans are required to return results, but in most situations prepared statements should be used to where-ever possible to increase performance.

Posted by Todd Greenstein

As a Solution Architect at Couchbase. I'm currently specializing in NOSQL design, architecture, data modeling, nodejs and golang development, API design and proof of concepts.

Leave a reply