Introduction to Couchbase for Oracle Developers and Experts: Part 6: Indexing

Here are the previous articles comparing architecture, database objects, data types, data modeling, and statements and features of Oracle with Couchbase. This post will focus on indexing.  

"Use the Index, Luke!"  -- Source 

Overview



Oracle

Couchbase

Index Documentation

Index Documentation

Types of Indexes: 

Index Advisor Service for Couchbase N1QL (SQL for JSON)

Couchbase N1QL is a SQL-like language for JSON data. To retrieve and manipulate JSON data effectively, we need appropriate indexes. The rules for creating these indexes can be read here. But that involves too much reading, hence we now have an Index Advisor service that accepts a query and gives out an index recommendation that would meet the expectations of the Couchbase query engine — all without downloading the latest Couchbase server.

This service will provide index recommendations to help DBAs, developers, and architects optimize query performance and meet the SLAs.

Index Advisor for Query Workload

Let's work with index advisor for query workload.

Overview

As the second feature of Index Advisor released in Couchbase server 6.5 (Developer Preview), the Advisor function extends the scope from advising on a single query to providing index recommendations for query workload and support on session handling. In this article, we look at a brief review of how it works in these two different ways.

You may also like: Indexing Best Practices

Advisor Function On Workload

Advisor function works in the following steps:

Index Advisor for Couchbase N1QL Query Statement

Couchbase N1QL query statement

Overview

Index advisor is introduced in Couchbase server 6.5 as a developer preview feature. It targets at providing secondary index recommendation to help DBAs and developers optimize Couchbase N1QL query performance. This version is rule-based, and the index candidates will be generated following the design rules specified here.

  1. Leading array index key for unnest
  2. Equality predicates
  3. IN predicates
  4. Not less than/between/not greater than predicates
  5. Less than/greater than predicates
  6. Array predicates
  7. Derived join filter as leading key for left-hand-side keyspace
  8. IS NOT NULL/MISSING/VALUED predicates
  9. Functional predicates
  10. Partial index condition

Index advisor is designed to work in two ways: