Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-40083

Index Advisor to support relative path and full path for collection

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • Major
    • 7.0.0
    • Cheshire-Cat
    • query
    • 1

    Description

      https://docs.google.com/document/d/11c0LHPi5JCAn7-ROlDIpngbCiDZVLtmO

      Initial Ideas:

      For advise statement:
      Advise index with both relative and full paths when applicable.

      • Advise index with relative path for collection when query context is set, provide information of query context, optimize the naming of each output field.
      • Advise index only with full path for collection when query context is not set.

      For Advisor function for workload:
      Advise index with full path.

      For advisor function for session handling:
      Collect query context for each query coming from system:completed request, apply each individual query context to the query. Recommend index with full path.

       advise select id from mycollection where id > 10 and name = "demo";
       
          "results": [
          {
              "#operator": "Advise",
              "advice": {
                  "#operator": "IndexAdvice",
                  "adviseinfo": {
                      "recommended_indexes": {
                          "covering_indexes": [
                              {
                                  "keyspace_alias": "mycollection",
                                  "query_context": "default:bucket1.myscope",
                                  "statement_full": "CREATE INDEX adv_id_name ON `default`:`bucket1`.`myscope`.`mycollection`(`id`) WHERE `name` = 'demo'",
                                  "statement_relative": "CREATE INDEX adv_id_name ON `mycollection`(`id`) WHERE `name` = 'demo'"
                              }
                          ],
                          "indexes": [
                              {
                                  "keyspace_alias": "mycollection",
                                  "query_context": "default:bucket1.myscope",
                                  "recommending_rule": "Index keys follow cost-based order.",
                                  "statement": "CREATE INDEX adv_id_name ON `default`:`bucket1`.`myscope`.`mycollection`(`id`) WHERE `name` = 'demo'",
                                  "statement_relative": "CREATE INDEX adv_id_name ON `mycollection`(`id`) WHERE `name` = 'demo'"
                              }
                          ]
                      }
                  }
              },
              "query": "select id from mycollection where id > 10 and name = \"demo\";"
          }
        ]
      
      

      Attachments

        For Gerrit Dashboard: MB-40083
        # Subject Branch Project Status CR V

        Activity

          People

            ajay.bhullar Ajay Bhullar
            chang.liu Chang Liu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty