N1QL (Couchbase 7.6 / SQL++)
This assessment applies the coupling account — coupling as access to a shared resource, and the coupling floor [1], [2] — and the knowledge-embodiment theorem [3]; the language is assessed against its official reference [4].
Snapshot N1QL (Couchbase 7.6 / SQL++) — released November 2023 · lifecycle current
Family N1QL — shelf: Data and Science
The language’s primary object is a dataset or a numeric array, not a program loop. A shelf groups; it does not classify — the tags below carry every use, paradigm, and platform of this snapshot.
Trajectory N1QL 4.1 (May 2016 — first release with Couchbase Server 4.1) · SQL++ foundations (September 2019 — query language rebuilt on SQL++ with Couchbase 6.0) · Couchbase 7.6 (November 2023 — assessed release)
Tags
Use — Data and statistics, Query
Paradigm — Declarative
Lifecycle — Current
Memory — Runtime-managed
Typing — Static, strong
Resources
The language’s official entry points, and the documents that name the release this page assesses. A link marked this release pins the document to N1QL (Couchbase 7.6 / SQL++); an unmarked link is the current reference for the language.
Landing page
Specification and reference
Tutorial
1 Assessment
This page assesses N1QL in five parts: core coupling — what the language’s own constructs force; ecosystem coupling — what the surrounding platform, tooling, and community cost; engineering readiness — whether the artifact can be reproduced, verified, observed, worked in quickly, connected to other languages, and governed openly; the profile — the unscored facts a score cannot express; and the scoring detail — the mechanism marks and the arithmetic behind every score. A ✅ bullet marks a construct that helps. A ⚠️ or ❌ bullet marks a cost; the scoring model does not price every cost named here.
Core coupling 85.4/100 · Ecosystem coupling 61.3/100 · Engineering readiness 61.4/100
1.1 Core coupling
1.1.1 Type
- ❌ No sum types: An alternative is encoded with
MISSING,NULL, and discriminator fields, and expressions test the encoding by convention (T4) - ❌ No generics: A query cannot be parameterised over a type, so reusable logic is copied, stored as a view, or wrapped in a JavaScript function (T5)
- ❌ MISSING and NULL are distinct values: An absent field and a null field compare unequal, and comparisons over them form a three-valued logic (T10)
- ❌ A call’s signature says what it returns, not what it does: A JavaScript user-defined function runs in the query service, and the statement shows the call, not the body’s effects (T12)
- ❌ User-defined JavaScript crosses into the query service unchecked: A function is declared by name, and the engine does not check its body against typed expectations (T14)
- ✅ Type expressions are checked at prepare time: SQL++ type expressions validate typed paths against the query’s declared types before execution
1.1.2 Construction
- ✅
NESTandUNNESTcompose nested collections without shared state: A query flattens and groups embedded arrays inside its own clauses - ⚠️ Keyspace semantics reach past the query:
USE KEYS,USE INDEX, and covering-index clauses bind a statement to storage design - ⚠️ Views store statements server-side: A stored view is a dependency a reviewer must fetch from the cluster to read a query in full
1.1.3 Memory
- ✅ The cluster owns allocation: Index entries, join buffers, and result streaming are managed by the services, not by the statement
- ⚠️ Large joins can exhaust service memory: An unbounded nested-loop join over big keyspaces streams results only after the join completes
1.1.4 Error
- ✅ Syntax and scope errors are caught at prepare time: Unknown keyspaces, malformed clauses, and bad aliases are reported before the statement runs
- ⚠️ Runtime failures depend on the data: Casts, arithmetic on strings, and array-index faults surface only when the matching document is reached
1.1.5 Concurrency
- ✅ Transactions group writes atomically:
BEGIN,COMMIT, andROLLBACKwrap N1QL writes in a distributed transaction - ⚠️ Isolation is service-specific: The transaction service’s isolation levels decide what a concurrent statement observes
1.1.6 Platform
- ❌ N1QL runs only inside a Couchbase cluster: The query service, the index service, and the data services are one vendor’s product, and no other engine implements the dialect (P1)
- ❌ N1QL is a poor fit outside database work: General application logic, loops beyond queries, and external I/O are pushed to a host language (P4)
- ⚠️ SQL++ is the shared core, not the dialect: The standard’s scope covers the common language, while Couchbase’s clauses remain vendor-defined
1.1.7 Trade-offs (not coupling)
- SQL familiarity against document semantics: The SQL-shaped surface carries readers in fast;
NEST,UNNEST, and keyspace clauses are new material the familiarity does not cover - MISSING and NULL keep absent fields honest: The document model distinguishes absent from null, and three-valued comparisons become a cost every reader pays
- Vendor clauses buy performance:
USE KEYSand covering-index directives buy plan control at the cost of binding a statement to one product’s storage - JavaScript functions extend the language: User-defined functions buy general computation at the cost of an unchecked boundary in the query service
1.2 Ecosystem coupling
1.2.1 Performance
- ✅ The query service compiles statements to a distributed plan: Index selection, join order, and partition pruning are planned before execution
- ⚠️ Plan quality depends on index design: A statement is fast with a covering index and a full keyspace scan without one
1.2.2 Ecosystem
- ❌ Tooling fragments across editions and syntax generations: The Query Workbench, the
cbqCLI, and the drivers target Couchbase versions at different support levels (Ec2) - ❌ The N1QL ecosystem is niche: The library pool, hiring market, and third-party tooling are thinner than for SQL and the major document stores (Ec3)
- ❌ The server, the tooling, and the documentation come from Couchbase under licence: Enterprise features sit behind a commercial licence, and Community Edition ships under SSPL (Ec4)
- ❌ Pre-6.0 N1QL syntax is still accepted alongside SQL++: Two generations coexist in the query service, so every new feature inherits the compatibility surface (Ec7)
- ✅ Official SDKs cover the mainstream languages: Couchbase maintains SDKs for many ecosystems, installed through ordinary package managers
1.2.3 Evolution
- ❌ Releases changed the language’s surface: The move from N1QL 5 syntax to SQL++-based 6.0, and deprecations across 7.x, put a version agreement under every statement (V1)
- ❌ The SQL++ standard moves on a committee cycle: The GDMC working group publishes drafts slowly, and Couchbase ships clauses engine-first (V4)
- ✅ Release notes name each query feature’s version: The documentation states which Couchbase release introduced each clause
1.2.4 Domain
- ❌ Adopting N1QL means adopting the Couchbase platform: The language is tied to the document store, the query service, and the index service (D1)
- ✅ N1QL is used to query stored document data:
SELECT ... FROM keyspaceretrieves documents, andINSERT,UPDATE, andMERGEwrite them - ⚠️ Nested-document joins are non-SQL:
NEST,UNNEST, andUSE KEYScarry document semantics a relational reader must learn separately
1.2.5 Learning
- ✅ The SQL-shaped surface transfers:
SELECT,FROM,WHERE, and joins read as SQL to anyone with SQL experience - ❌ Advanced material is thin: Index design, planner behaviour, and join semantics are documented by example and by blog posts, not systematically (L3)
- ⚠️ Keyspace and index idioms take practice: Covering indexes, partial indexes, and scan directives are storage decisions a newcomer must learn alongside the language
1.2.6 Syntax
- ❌ Comparable things are written differently:
NESTandUNNESTpair where SQL uses subqueries,USE KEYSselects by key, and pre-6.0 statements used positional aliases (S2) - ⚠️ Backtick-quoted keyspaces carry the names: `
`travel-sample```, quoting keyspace names, reads as a delimiter convention - ✅ Statements read as SQL clauses in order: A query’s shape is visible without learning a new dataflow model
1.2.7 Testing
- ❌ No test harness ships with the language: Testing N1QL requires a running cluster and a harness each project builds for itself (G1)
- ⚠️ Plan review is standard practice:
EXPLAINreports the chosen plan, and the Query Workbench shows it while the author edits - ❌ No monotonic clock is published in the language:
now()andlocal_now()read the wall clock, so elapsed-time tests depend on cluster clocks (G4)
1.2.8 Security
- ❌ String-built statements are an injection surface: Concatenating untrusted input into a statement text lets that input change the parse (Q3)
- ❌ Documents arrive untyped at write time: Field types in a schemaless keyspace are data, so a query must re-check each type at every use (Q2)
- ✅ Parameterised statements remove the injection surface: Bound parameters carry data out of band, so a value cannot become syntax
1.2.9 Delivery targets
What ships from a producer to a consumer, and whether the interface across a release boundary is promised. Ec8 is present when one compiled target crosses with no promise.
| Target | Ships as | Crosses a producer boundary | Cross-release promise |
|---|---|---|---|
| stored program | script | no | The query service receives and parses the statement text; no compiled unit crosses a boundary. |
1.3 Engineering readiness
1.3.1 Reproducibility
- ✅ A statement is a request text: The same statement submitted to the same cluster version and dataset produces the same result, and there is no build artifact to reproduce (Y1)
- ⚠️ Statements live beside the application that submits them: A deployment stores no manifest naming the server version the statement was written against
1.3.2 Supply chain
- ❌ Published SDKs carry no signed provenance by default: A consumer must trust the package they install (Y3)
- ✅ SDKs publish in registries with an ownership model: Package names on npm, PyPI, and Maven identify the publisher, so there is no flat namespace to hijack (Y4)
- ✅ Couchbase publishes security advisories naming the affected product and version: A consumer reads a published CVE record to learn a server release or SDK version is affected (Y16)
1.3.3 Observability
- ❌ No stable tracing and metrics standard is part of the language: Observability is provided by the server’s own metrics services (Y5)
- ❌ No structured logging is defined in the language: Diagnostics are server log entries with their own format (Y6)
- ✅ Failed queries are recorded by the server: The query log and request status inspector name the statement, its duration, and its error (Y15)
1.3.4 Feedback
- ✅ The edit-test loop is a text submission: There is no compile step between editing a statement and running it (Y7)
- ❌ No fast in-editor analysis ships for N1QL: Syntax is checked when the statement is submitted; editors have no incremental analyser for the language (Y8)
- ❌ No source-level debugger ships with the language: Debugging is done through explain plans, the query log, and Workbench traces (Y13)
1.3.5 Interop
- ✅ User-defined functions call host-language code: JavaScript functions extend the query service without leaving the process (Y9)
- ❌ The statement runs only inside a Couchbase cluster: The plan spans the query, index, and data services of one product (Y10)
1.3.6 Governance
- ❌ Governance is Couchbase-led: The dialect ships with the query service, and the roadmap follows the vendor (Y11)
- ✅ The SQL++ core has a public draft specification: The GDMC working group publishes the shared language for independent implementation (Y12)
- ❌ No conformance suite exists: SQL++ implementations cannot run a shared test suite against the draft standard (Y17)
- ✅ The N1QL parser is open source: Couchbase publishes the parser on GitHub, so third-party tools can parse statements (Y19)
1.4 Profile
Unscored, and kept separate from every score on purpose. The profile records what a mechanism price cannot express: what a running program costs, how well a coding model and an agent work in the language, and whether a safety-critical path exists.
1.4.1 Energy and cost
What this axis asks: what does a running program cost in energy and time?
- ⚠️ Runs inside a Couchbase cluster: energy and time are the services’, not the statement’s.
1.4.2 AI and agent readiness
What this axis asks: how well does a coding model and an agent work in this language?
- ✅ SQL-shaped statements with public examples: current models write common N1QL queries reliably, though keyspace and index clauses need review.
1.4.3 Safety certification
What this axis asks: is there a certified or standards-qualified path to a safety-critical system?
- ⚠️ No certified or standards-qualified path for safety-critical systems.
1.5 Scoring detail
1.5.1 Core coupling Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Type | T1 |
dynamic no static check | language | — | 0 |
T2 |
weak static | language | — | 0 | |
T3 |
dynamic/duck dispatch | language | — | 0 | |
T4 |
no sum types | language | ✅ | −4 | |
T5 |
no generics | language | ✅ | −4 | |
T6 |
no namespaces | language | — | 0 | |
T7 |
type erasure/reflection | language | — | 0 | |
T8 |
operator overloading | language | — | 0 | |
T9 |
inheritance required for polymorphism | language | — | 0 | |
T10 |
no null-safety | language | ✅ | −8 | |
T11 |
no module boundary | language | — | 0 | |
T12 |
no effect tracking | language | ✅ | −8 | |
T13 |
async/sync colouring | language | — | 0 | |
T14 |
unchecked foreign boundary | language | ✅ | −4 | |
T15 |
chars are encoding units | language | — | 0 | |
| Type cost | −8.0 (−28) | ||||
| Construction | C1 |
global mutable state by default | language | — | 0 |
C2 |
no immutability by default | language | — | 0 | |
C3 |
constructors coupled to allocation | language | — | 0 | |
C4 |
no constructor/validation | language | — | 0 | |
C5 |
unpinned collection order | language | — | 0 | |
C6 |
aliasing by default | language | — | 0 | |
C7 |
undeclared control transfer | language | — | 0 | |
C8 |
no source-visible init order | language | — | 0 | |
| Construction cost | 0 | ||||
| Memory | M1 |
manual deallocation | runtime | — | 0 |
M2 |
GC non-deterministic pauses | runtime | — | 0 | |
M3 |
no RAII | language | — | 0 | |
M4 |
no ownership model | language | — | 0 | |
M5 |
uninitialized reads | language | — | 0 | |
M6 |
unchecked reinterpretation | language | — | 0 | |
Er6 |
uncatchable runtime fault | language | — | 0 | |
M7 |
reference cycles leak | runtime | — | 0 | |
| Memory cost | 0 | ||||
| Error | Er1 |
no structured path | language | — | 0 |
Er2 |
unchecked exceptions only | language | — | 0 | |
Er3 |
errors ignored/non-exhaustive | language | — | 0 | |
Er4 |
no composable result type | language | — | 0 | |
Er5 |
no isolation unit for a fault | runtime | — | 0 | |
| Error cost | 0 | ||||
| Concurrency | K1 |
GIL/no parallel | runtime | — | 0 |
K2 |
shared mutable state default | language | — | 0 | |
K3 |
manual sync no race detection | runtime | — | 0 | |
K4 |
no structured concurrency | language | — | 0 | |
K5 |
no primitives | language | — | 0 | |
K6 |
thread-per-task cost | runtime | — | 0 | |
| Concurrency cost | 0 | ||||
| Platform | P1 |
cannot function outside one vendor/domain | context | ✅ | −15 |
P2 |
single-vendor but other uses | context | — | 0 | |
P3 |
legacy/discontinued platform | context | — | 0 | |
P4 |
poor domain fit | context | ✅ | −8 | |
| Platform cost | −6.6 (−23) |
Core coupling score: 85.4/100 — 51 of the 350 inventory points are present, so the axis cost is 100 × 51 ÷ 350 = 14.6 and the score is 100 − 14.6. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
1.5.2 Ecosystem coupling Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Performance | R1 |
interpreted no AOT/JIT | runtime | — | 0 |
R2 |
GC pauses | runtime | — | 0 | |
R3 |
JIT warmup | runtime | — | 0 | |
| Performance cost | 0 | ||||
| Ecosystem | Ec1 |
no package manager | context | — | 0 |
Ec2 |
fragmented tooling | context | ✅ | −8 | |
Ec3 |
small/niche/discontinued | context | ✅ | −8 | |
Ec4 |
proprietary | context | ✅ | −8 | |
Ec5 |
platform-locked tooling | context | — | 0 | |
Ec6 |
monoculture | context | — | 0 | |
Ec7 |
legacy burden | context | ✅ | −8 | |
Ec8 |
unpromised binary boundary | context | — | 0 | |
Ec9 |
unpromised data boundary | context | — | 0 | |
| Ecosystem cost | −12.5 (−32) | ||||
| Evolution | V1 |
breaking changes | language | ✅ | −8 |
V2 |
frozen | context | — | 0 | |
V3 |
discontinued | context | — | 0 | |
V4 |
glacial standards | context | ✅ | −4 | |
V5 |
silent default drift | runtime | — | 0 | |
V7 |
build-variant state space | context | — | 0 | |
| Evolution cost | −4.7 (−12) | ||||
| Domain | D1 |
domain/vendor lock-in | context | ✅ | −15 |
D3 |
framework forces architecture | context | — | 0 | |
| Domain cost | −5.9 (−15) | ||||
| Learning | L1 |
steep | context | — | 0 |
L2 |
large surface/multi-paradigm | context | — | 0 | |
L3 |
sparse docs | context | ✅ | −4 | |
| Learning cost | −1.6 (−4) | ||||
| Syntax | S1 |
verbose | language | — | 0 |
S2 |
inconsistent | language | ✅ | −8 | |
S3 |
punctuation-heavy | language | — | 0 | |
| Syntax cost | −3.1 (−8) | ||||
| Testing | G1 |
weak tooling | context | ✅ | −8 |
G2 |
poor debugging | context | — | 0 | |
G3 |
runtime-only errors | context | — | 0 | |
G4 |
no published monotonic clock | runtime | ✅ | −4 | |
| Testing cost | −4.7 (−12) | ||||
| Security | Q1 |
memory-unsafe | language | — | 0 |
Q2 |
dynamic/weak typing risk | language | ✅ | −8 | |
Q3 |
known vulnerability/injection | context | ✅ | −8 | |
Q4 |
silent integer overflow | language | — | 0 | |
| Security cost | −6.2 (−16) |
Ecosystem coupling score: 61.3/100 — 99 of the 256 inventory points are present, so the axis cost is 100 × 99 ÷ 256 = 38.7 and the score is 100 − 38.7. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
1.5.3 Engineering readiness Dimensions
| Dimension | Mechanism | Description | Imposed by | Present | Weight |
|---|---|---|---|---|---|
| Reproducibility | Y1 |
build not reproducible | context | — | 0 |
Y2 |
dependencies not pinned | context | — | 0 | |
Y14 |
no toolchain version pin | context | — | 0 | |
Y18 |
no machine-read project contract | context | — | 0 | |
| Reproducibility cost | 0 | ||||
| Supply chain | Y3 |
no signed provenance | context | ✅ | −15 |
Y4 |
registry without namespacing | context | — | 0 | |
Y16 |
no advisory feed | context | — | 0 | |
| Supply chain cost | −8.8 (−15) | ||||
| Observability | Y5 |
no stable tracing standard | context | ✅ | −8 |
Y6 |
no structured logging | context | ✅ | −4 | |
Y15 |
no post-mortem diagnostics | runtime | — | 0 | |
| Observability cost | −7.0 (−12) | ||||
| Feedback | Y7 |
slow build | context | — | 0 |
Y8 |
no fast in-editor analysis | context | ✅ | −4 | |
Y13 |
no bundled debugger | context | ✅ | −8 | |
| Feedback cost | −7.0 (−12) | ||||
| Interop | Y9 |
no foreign-function interface | language | — | 0 |
Y10 |
no portable target | context | ✅ | −4 | |
| Interop cost | −2.3 (−4) | ||||
| Governance | Y11 |
single-vendor governance | context | ✅ | −15 |
Y12 |
closed specification | context | — | 0 | |
Y17 |
no conformance mechanism | context | ✅ | −8 | |
Y19 |
no published parser | context | — | 0 | |
| Governance cost | −13.5 (−23) |
Engineering readiness score: 61.4/100 — 66 of the 171 inventory points are present, so the axis cost is 100 × 66 ÷ 171 = 38.6 and the score is 100 − 38.6. Each dimension’s cost above is its share of the same denominator, and the raw weight sum follows in parentheses.
Verdict: N1QL’s coupling is set by its host, not by its SQL-shaped surface. The clause structure transfers to anyone with SQL experience, prepare-time checks catch syntax and scope errors, and bound parameters close the injection surface a string-built statement opens. What the language charges: it runs only inside a Couchbase cluster, its vendor clauses sit beyond the SQL++ standard, two syntax generations coexist under the query service, and the ecosystem is niche behind a vendor licence. Main strengths: SQL-shaped access to nested JSON, distributed joins planned by the query service, and a public parser with a public draft standard for its core. Main weaknesses: single-vendor governance with no conformance suite, sparse advanced documentation on index and planner behaviour, and JavaScript user-defined functions that cross an unchecked boundary.
The formal development. The definitions, theorems, and proofs behind this page are published in:
- On the Nature of Coupling: All Coupling as Shared Resource Access — Zenodo, 2026 — doi:10.5281/zenodo.21925122
- Coupling as a Consequence of Cohesion: Decomposition, the Coupling Floor, and Domain-Imposed Coupling — Zenodo, 2026 — doi:10.5281/zenodo.21925201
- On the Nature of Cohesion: Cohesion as Correctness Relative to a Partitioning Rule — Zenodo, 2026 — doi:10.5281/zenodo.21703193