Serdar Yegulalp
Senior Writer

SQL on NoSQL? Couchbase 4.0 has a plan

news analysis
Oct 6, 20153 mins
Data ManagementNoSQL Databases

The NoSQL document store's new SQL query language aims to make document data useful to existing and previous-generation analytics and reporting tools

nosql
Credit: Tim Lossen

Version 4.0 of Couchbase Server, a NoSQL document store that competes with the likes of MongoDB and Cassandra, is now available. Its main mission is to make working with unstructured data (namely JSON) as easy as querying more conventional row-and-column databases.

Couchbaseย is following the success of projects like Spark to provide easy-to-program tools that obtain quick, actionable results. In Couchbaseโ€™s eyes, SQL is still one of the best ways to accomplish the task.

I speak SQL to my document store

Couchbase Server 4.0 usesย N1QL,ย a query language that extends the SQL syntax with commands specific to JSON documents.ย JSON syntax can nest data within other data, so some of the extensions allow developers to unnest documents and treat them as if they were conventional tabular data.

The language only targets SQL โ€™92, so it doesnโ€™t provide some of the latest and most powerful SQL syntax, nor does it support transactions. But other developer-oriented functions are available, such as the EXPLAIN keyword for describing how the query optimizer processes a statement. Plus, Couchbase plans to add features like transactions over time.

InfoWorldโ€™s Ian Pointer took aย prerelease version of Couchbase 4โ€™s N1QLย for a test-drive. Based on what he saw, Pointer claimed the view system for Couchbase,ย which is currentlyย used to extract data from the system, could in time โ€œslowly [fade] away as N1QL becomes the standard for interacting with Couchbase documents.โ€ย Couchbase wants N1QL to be akin to the SQL that people know and use, not merely a crippled subset of it.

Couchbase isnโ€™t alone in providing a SQL-like query language. Cassandra has CQL, which has beenย the official query interface for the systemย since version 2.0. But N1QL provides some features not offered in Cassandra 2.0, such as JOIN operations. MongoDB also has a SQL connector, slated for the 3.2 release, designed to help interface with third-party products like Tableau โ€” but it too lacks the ability to perform JOINs.ย 

Old school vs. new school

If the transformative power of big data tools is best unleashed through programmatic interfaces โ€” for example, Couchbaseโ€™s view and map/reduce jobs โ€” why are envelope-pushing products like Couchbase, Cassandra, and MongoDB adding old-school SQL interfaces? (The irony of โ€œSQL on NoSQLโ€ is hard to ignore.)

One obvious reason is to connect their products to legacy BI tools that use SQL for querying. But another reason, according to Couchbase, is that despite its limitations, SQL allows for rapid application development since a good deal can be accomplished in a query with relatively little code. Sometimes, a simple SQL query is more than enough.

Similar claims are made for the Hadoop data-processing framework Spark โ€” not because it offers its own SQL query mechanism, Spark SQL, but because it provides native data-access methodologies that tend to be less verbose to work with than the competition. Couchbase is touting SQL via N1QL as a way to get results fast while still respecting connectivity with existing BI products.

The real change, though, may come when front-end BI products choose to speak the new native languages of big data. Tableau, for instance, added a Spark SQL connectorย earlier this year โ€” a possible prelude to deeper integration with Spark. ย 

In the meantime, Couchbase is making itself useful to the SQL-based analytics systems out there rightย now.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author