โ ๏ธ WARNING โ ๏ธ
Primary index scans in production can cause full bucket scans
leading to
severe performance issues
Count | User |
---|
Count | Index Name | Bucket.Scope.Collection |
---|
To analyze indexes, run this query in your Couchbase Query Workbench and paste the results in the second textarea above:
SELECT s.name, s.id, s.metadata, s.state, s.num_replica, CONCAT("CREATE INDEX ", s.name, " ON ", k, ks, p, w, ";") AS indexString FROM system:indexes AS s LET bid = CONCAT("", s.bucket_id, ""), sid = CONCAT("", s.scope_id, ""), kid = CONCAT("", s.keyspace_id, ""), k = NVL2(bid, CONCAT2(".", bid, sid, kid), kid), ks = CASE WHEN s.is_primary THEN "" ELSE "(" || CONCAT2(",", s.index_key) || ")" END, w = CASE WHEN s.condition IS NOT NULL THEN " WHERE " || REPLACE(s.condition, '"', "'") ELSE "" END, p = CASE WHEN s.`partition` IS NOT NULL THEN " PARTITION BY " || s.`partition` ELSE "" END;
Steps:
1. Copy the query above
2. Run it in Couchbase Query Workbench
3. Copy the JSON results
4. Paste into the second textarea ,on the right, at the top
5. Click "Parse JSON" again