As any parent of a five year old can attest, time flies when you’re having fun. Where did all the time go? That’s kind of how we feel with N1QL, the SQL for JSON query language. Today, thousands of developers, customers and modern applications use N1QL in their applications to access, analyze, and manipulate data.

A N1QL Refresher

Couchbase created N1QL to make it easier for enterprise developers to make the transition to NoSQL. While moving to NoSQL already offers significant advantages, not all NoSQL databases are equal because their query languages are different. Most other NoSQL databases have limited SQL support — or none at all.

Having limited or no SQL support makes the migration of applications very expensive because the data access layer must be rewritten and developers must be retrained. (Remember: NoSQL means “not only SQL.”) N1QL gives application developers an expressive, powerful, and complete declarative language with industry standard ANSI joins for querying, transforming, and manipulating JSON data – just like SQL. Developers can visualize and optimize complex query plans for large datasets and deliver the best performance at any scale to meet the demands of millions of users.

By combining the power of SQL with the flexibility of JSON, N1QL allows developers to
write ad hoc queries without limitations. By slicing and dicing data with select, ANSI joins,
project, nest, unnest, group, sort, window functions, CTEs, user defined functions, and other data manipulation functions within a single query, developers can improve efficiency at the speed of business.


And over the years, companies have been choosing Couchbase over other NoSQL solutions because of the SQL-like query language in N1QL.

“When Couchbase introduced me to N1QL, we quickly realized that N1QL offers the flexibility to search with a language that looks 99 percent the same as SQL. So for all developers, it was an easy transition.”
FIDENCIO GARRIDO
Principal Engineer, DIRECTV

The Formative Years

To enable our customers to develop at the pace of their respective businesses, N1QL’s first five years have been shaped by consummate innovation:

2015: GA of N1QL in query service with Couchbase 4.0
2016: Array indexing, MOI & pagination improvements with Couchbase 4.5
2017: Aggregation push down to index, replica index, Plasma for GSI with Couchbase 5.0
2018: ANSI Joins, Index partitioning & pruning with Couchbase 5.5
2018: GA of N1QL in analytics with Couchbase 6.0
2020: Window analytic functions, search support, Index advisor with Couchbase 6.5
2020: Flex index, Support for external datasets, remote links with Couchbase 6.6
2021: The future is here. See below!

What’s New — Couchbase Connect.ONLINE

We have a lot of exciting features in the upcoming release. Join us for a presentation during Couchbase Connect.ONLINE on October 14th from 1:00 pm to 2:00 p.m Pacific Time as we preview on what’s new In N1QL. Here are some of the features we’ll cover: collections support in N1QL and Indexes, Cost Based Optimizer, User defined Functions, and Transactions. Yes – distributed transactions for N1QL.

How does N1QL Compare to SQL?

SQL is vast in its syntax, deep in its semantics and rich in features. How does N1QL compare to SQL in its features? Here’s the ten thousand foot view of it!

N1QL for your thoughts?

Are you a Couchbase customer using N1QL? Drop a line in the comments and let me know how your transition went or any other highlights you’d like to share.

Author

Posted by Binh Le

Binh Le is a Principal Product Manager for Couchbase Query service. Prior to Couchbase, he worked at Oracle and led the product management team for Sales Clould Analytics and CRM OnDemand. Binh holds a Bachelor's Degree in Computer Science from the University of Brighton, UK.

One Comment

  1. Hi Binh,

    The transition is in progress and it has been interesting with some challenges especially because of 2 reasons:
    – JSON data model (as against the data model in a RDBMS)
    – query, index & data being different services (as against the engine/optimizer in a RDBMS)

    The unlearning (of RDBMS/SQL) part if very amusing!

    More documentation around N1QL, possibly internals, will help to smoothen that learning curve. Also, it will be interesting to see the upcoming cost based optimizer for N1QL.

    Thanks

Leave a reply