Prepared Statements – by the Numbers!

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.

Share this article
Get Couchbase blog updates in your inbox
This field is required.

Author

Posted by Todd Greenstein

Todd Greenstein is a Solution Architect at Couchbase. Todd is specialize in API design, architecture, data modeling, nodejs and golang development.

Leave a comment

Ready to get Started with Couchbase Capella?

Start building

Check out our developer portal to explore NoSQL, browse resources, and get started with tutorials.

Use Capella free

Get hands-on with Couchbase in just a few clicks. Capella DBaaS is the easiest and fastest way to get started.

Get in touch

Want to learn more about Couchbase offerings? Let us help.