News

Couchbase Adds SQL-Based JSON Queries

After some four months in beta, the new Couchbase database platform emerged yesterday with its new N1QL language that allows developers to hook into JSON data stores with declarative, SQL-based queries.

Couchbase said its new platform and query language will help developers using its platform build more kinds of Web, mobile and Internet of Things (IoT) applications.

Pronounced as "nickel," the new N1QL language, originally unveiled in February, stems from the database normalization term "non-first normal form" to stand for "Non-first Normal Form Query Language."

"N1QL is based on SQL," Couchbase said. "It has familiar data definition language (DDL), data manipulation language (DML) and query language statements, yet it works on NoSQL database features such as key-value stores, multi-value attributes and nested objects. If you know SQL, you can easily learn N1QL -- in fact, you're already more than halfway there."

SQL has traditionally been used to query data stored in relational database management systems (RDBMS) by adhering to a rigid schema of inter-related tables that contain rows and columns. Couchbase developed N1QL to query data stored as JSON, popularized in Web development as a companion tool to JavaScript (JSON stands for JavaScript Object Notation) to transmit data as attribute-value pairs between servers and clients.

SQL vs. N1QL: A Sample WHERE Query to Retrieve New Books
[Click on image for larger view.] SQL vs. N1QL: A Sample WHERE Query to Retrieve New Books (source: Couchbase)

Couchbase exec Cihan Biyikoglu explained the idea in a blog post last June. "Relational SQL operates over tables and columns and needs a strict schema," Biyikoglu said. "With N1QL, all queries are executed over JSON data in Couchbase Server. You don't have to deal with a strict tables and columns structure or worry about changing schema as your data model evolves."

Couchbase's Matthew Revell said in a blog post yesterday that the new release of Couchbase Server 4.0 closes the gap between the querablity of SQL and scalability of NoSQL, a document-oriented approach that emphasizes scale, uptime and redundancy, making it ideal for the burgeoning Big Data movement.

"Not only do we continue to get the scale and speed of a clustered document database with in-built caching, but for the first time we get a generally applicable declarative query language for those JSON documents," Revell said.

In conjunction with the SQL declarative query ability, the updated Couchbase platform allows SQL-based reporting and data visualization via ODBC and JDBC connectivity provided through Simba drivers, the company said in a statement yesterday.

Two architectural innovations reportedly improve query performance, Couchbase said, through Multi-Dimensional Scaling and Global Secondary Indexing. Also, the company said, the new release comes with high availability and disaster recovery functionality via Cross Datacenter Replication (XDCR).

"Our research suggests that enterprises are making strategic investments in more agile, multi-model databases that serve a variety of needs that existing relational databases were never designed for," the company quoted 451 Research analyst Matt Aslett as saying. "New features such as N1QL, Multi-Dimensional Scaling and Secondary Indexes means that Couchbase Server 4.0 addresses a wider range of use cases, encouraging expanded enterprise adoption of NoSQL."

About the Author

David Ramel is an editor and writer at Converge 360.