Couchbase 4.0 Server: N1QL (SQL + JSON), Multi-dimensional scaling, Global secondary index, more

Couchbase is an open source, document-oriented NoSQL database for modern web, mobile, and IoT applications. It is designed for ease of development and Internet-scale performance.

Couchbase Logo

Couchbase 4.0 is a major release of the NoSQL database server  that includes significant advances in both architecture and features.

Download Couchbase Server 4.0 now!

The key features introduced in this version are:

  • N1QL (pronounced “nickel”): SQL-compatible query language for JSON documents
  • Multi-dimensional Scaling (MDS): Allows enterprises to isolate different workloads and independently scale the index, query, and data services.
  • Global Secondary Index: is a new access path to your data for faster lookup and higher throughput
  • Enhanced Security: Simplified compliance with security standards, LDAP integration, and auditing capabilities
  • Geospatial Indexes for location-aware applications
  • ForestDB, a new database engine
  • New filtering capabilities on Cross Data Center Replication (XDCR) allowing specific data to be replicated to specific geographical locations

With MDS and N1QL, Couchbase 4.0 becomes the first and only database to combine the powerful query capabilities of a relational database with the performance, scalability, and flexibility of a NoSQL database.

This is in addition to already an existing set of impressive features:

  • Developer-Focused
  • Consistent High Performance
  • Elastic Scalability
  • Always-On Availability
  • Enterprise Grade Administration
  • Data Mobility

and a lot more. Read more details each of these features in About Couchbase Server or Announcing Couchbase Server 4.0.

Lets look at some of the major features introduced in this version.

N1QL = SQL + JSON

N1QL is a comprehensive, declarative query language that brings SQL-like query capabilities to JSON documents. N1QL provides a rich set of features that let you retrieve, manipulate, transform, and create JSON document data.

N1QL Logo

Common SQL statements such as SELECT statement, Data Manipulation Language (DELETE, INSERT, UPDATE, UPSERT), Indexes, Primary Key Access, Aggregations, Joins, Nesting, Unions, Sub-queries, Union, Intersect, and much more can now be applied to JSON. Just use your knowledge of SQL and apply it to JSON documents.

The following query:

will give the result as:

Try yourself in this interactive N1QL tutorial.

A later blog will show how to get started with N1QL using Couchbase 4.0. But in the meanwhile, here are some resources to get started with N1QL:

  • Interactive N1QL Tutorial is an online interactive tutorial that runs in a browser and allows you to learn about N1QL without having Couchbase Server installed in your own environment. The tutorial covers SELECT statements in detail, including examples of JOIN, NEST, GROUP BY, and other typical clauses.
  • N1QL Cheat Sheet provides a concise summary of the basic syntax elements. 
  • N1QL Reference Guide contains details about N1QL syntax and usage.
  • N1QL Forums or N1QL at Stackoverflow is a community resource where you can ask questions, find answers, and discuss N1QL with other developers and the Couchbase team.

Difference between SQL and N1QL highlights the key difference between two.

N1QL has full compatibility with the SQL ecosystem via connectors and standard JDBC/ODBC drivers. This allows enterprises for the first time to connect popular ETL, reporting, and BI tools to Couchbase. Companies like Databricks, Looker, Simba Technologies, Informatica, Tableau, and Metanautix are all partnering with Couchbase to provide supported integrations.

Multi-dimensional Scaling

Query, Index, and Data are the three key database services. Query is CPU-intensive operation and so require a faster processor. Index is disk heavy and so require a faster solid state drive. Data needs to be read/written fast and so require more memory.

The needs for these services is quite different but yet existing databases put them together on a single node causing resource contention. For example, storing data and executing queries on the same node will cause CPU contention. Similarly, storing data and indexes on the same node will cause disk IO contention. There is network over head if a query needs to run by distributing to every node or an index needs to be stored on every node.

Couchbase 4.0 introduces innovative multi-dimensional scaling that enables to separate, isolate, and scale individual services – Query, Index, and Data – to improve application performance and resource utilization. This is in contrast to one-size-fits-all approach used by other NoSQL vendors.

Multi Dimensional Scaling in Couchbase

 

This is quite different from Oracle, MongoDB and Cassandra’s one-size-fits-all one dimensional scaling. It helps in improved performance, reduced hardware costs, and enables enterprises to support a much broader set of applications with a single database: Couchbase Server.

http://www.couchbase.com/press-releases/database-scaling-redefined-by-couchbase-multi-dimensional-scaling-outperforms-one-dimensional-scale-limitations-of-oracle-mongodb-and-cassandra

Global Secondary Index

Traditional local secondary indexes reside with data on every node of a Couchbase cluster. They’re great when you need to query all of the data, but because they query every node every time — even to return data that’s stored on a subset of the nodes — performance gets worse as the number of nodes increases.

Global Secondary Indexes (GSI) provide a new access path to your data for faster lookup and higher throughput. It’s a global index, so index lookup is much easier — there’s no need to query a local index on each data node and aggregate the results.

Learn more about GSI in this presentation from Couchbase Connect 2015:

Subsequent blogs will provide more details about each of these features and how to use them.

Here are some top-level links for you to get started:

Here is some media coverage:

Couchbase Server 4.0 – Develop with Agility and Operate at any Scale.

Be Sociable, Share!

6 thoughts on “Couchbase 4.0 Server: N1QL (SQL + JSON), Multi-dimensional scaling, Global secondary index, more

Leave a Reply

Your email address will not be published. Required fields are marked *