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 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.
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:
1
2
3
4
5
|
SELECT fname, age
FROM tutorial
WHERE age > 30
|
will give the result as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
{
"results": [
{
"age": 46,
"fname": "Dave"
},
{
"age": 46,
"fname": "Earl"
},
{
"age": 56,
"fname": "Ian"
},
{
"age": 40,
"fname": "Jane"
}
]
}
|
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.
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:
- Download Couchbase Server 4.0
- Release Notes
- Step-by-step Getting Started Guide
- Developer Guide using SDKs with Java, Go, C, Node.JS, .NET, PHP, Python, and Ruby
- Online, classroom, virtual, on-site training at training.couchbase.com
Here is some media coverage:
- Couchbase Releases V4 of NoSQL Database
- Couchbase 4.0 released, adds multi dimensional scaling and more
- Couchbase Makes Case for Enterprise-Class Document Database
- How Couchbase 4.0 is cranking up its developer appeal
- Couchbase announces general availability of its 4.0 Release: Introduces breakthrough developer agility and scaling innovations enabling broad enterprise re-platforming
- SQL on NoSQL? Couchbase 4.0 has a plan
- Couchbase Passes MongoDB in Functionality, CEO Claims
- Couchbase Server 4.0 Lets SQL Users Take A Seat
- Simba Technologies Introduces ODBC, JDBC Drivers for Couchbase Server 4.0
- How to Setup Couchbase as a Linked Server in Microsoft SQL Server
- Couchbase Server 4.0 opens the door to SQL on NoSQL
Couchbase Server 4.0 – Develop with Agility and Operate at any Scale.
6 thoughts on “Couchbase 4.0 Server: N1QL (SQL + JSON), Multi-dimensional scaling, Global secondary index, more”