couchbasesecondary-indexes

GIN-like index in Couchbase


As I saw in Couchbase documentation it's possible to create an index for the particular fields of a document: https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/createindex.html

CREATE INDEX country_idx ON `travel-sample`.inventory.airport(country, city)
WITH {"nodes": ["node1:8091", "node2:8091", "node3:8091"]};

Is it possible to create an index for all available fields just like GIN in PostgreSQL?

There is a statement in the section about Community-edition limitations:

In Couchbase Server Community Edition, a single global secondary index can be placed on a single node that runs the indexing service.

Could this "global index" be what I'm looking for? If so how I can create it?

P.S. This one-node limitation doesn't make a sense for me to be honest, even for community edition. What is the point to use the system that can't scale if scalability is its purpose? Maybe I got it wrong?


Solution

  • By default couchbase GSI index is called Global secondary index (Even though data distributed across different data nodes, index will have data from the all the nodes).

    Above statement means Community Edition will not support partition index or number of replica index (replica can be over come by creating duplicate index i.e. index with same definition with different name, during execution it will load balance the index scans).

    As far as all the fields of the document check out adaptive index, but better performance create targeted indexes.

    checkout 8 & 9 https://blog.couchbase.com/create-right-index-get-right-performance/