Deep Dive: Window Functions in Couchbase Analytics

Window Functions

Couchbase Server 6.5 Beta brings a host of new features to the leading NoSQL database. One of the key additions to the N1QL query language is support for window functions. These functions were originally introduced in the SQL:2003 standard and provide a performant way of answering many complex business queries. Window functions were previously discussed in this series of posts [2], [3], [4]. In this installment, we’ll dive deep into their implementations in Couchbase Analytics.

You may also like:  Cost-Based Optimizer for Couchbase N1QL (SQL for JSON)

The Couchbase Analytics service [5] is designed to handle complex ad-hoc queries in the Couchbase data platform. Its key component is the MPP query engine that runs on a separate set of nodes in the cluster to guarantee workload isolation for the operational data nodes. Data is ingested into Analytics using the DCP change protocol [6] and is hash-partitioned among all available Analytics nodes. The MPP query processor divides a single query into subtasks and schedules those to run in parallel on all nodes, repartitioning data if necessary.