Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-12314

Feedback on BUILD INDEX | Couchbase Docs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • None
    • None
    • query

    Description

      Browser environment: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

      Document following query Example 4.1

      How to build indexes on all collections

       

      SELECT RAW CONCAT("BUILD INDEX ON ", k , "(", REPLACE(ENCODE_JSON(inames),'\"',"'"), ");")
      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)
      WHERE s.namespace_id = "default" AND s.state  IN ["deferred", "error"]
      GROUP BY k
      LETTING inames = ARRAY_AGG(s.name)
      HAVING ARRAY_LENGTH(inames) > 0;
      

      Above command gives BUILD INDEX commands for each collection, take those run. Give a gap so that system will not overload

      Attachments

        Activity

          People

            simon.dew Simon Dew
            docsite-collector Docs Site Collector
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              PagerDuty