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

[FlexIndex] partial Sargability not working if having type in query predicate

    XMLWordPrintable

Details

    • Untriaged
    • Unknown

    Description

      Build: 7.0.0-1650

      Create fts index with :

      {
        "type": "fulltext-index",
        "name": "first_index",
        "uuid": "56f811ef92a0e4ba",
        "sourceType": "gocbcore",
        "sourceName": "travel-sample",
        "sourceUUID": "fc9f093fe7a0ed66a56351eb83d7cad5",
        "planParams": {
          "maxPartitionsPerPIndex": 171,
          "indexPartitions": 6
        },
        "params": {
          "doc_config": {
            "docid_prefix_delim": "",
            "docid_regexp": "",
            "mode": "type_field",
            "type_field": "type"
          },
          "mapping": {
            "analysis": {},
            "default_analyzer": "keyword",
            "default_datetime_parser": "dateTimeOptional",
            "default_field": "_all",
            "default_mapping": {
              "dynamic": false,
              "enabled": true,
              "properties": {
                "country": {
                  "dynamic": false,
                  "enabled": true,
                  "fields": [
                    {
                      "analyzer": "keyword",
                      "index": true,
                      "name": "country",
                      "type": "text"
                    }
                  ]
                }
              }
            },
            "default_type": "_default",
            "docvalues_dynamic": true,
            "index_dynamic": true,
            "store_dynamic": false,
            "type_field": "_type"
          },
          "store": {
            "indexType": "scorch"
          }
        },
        "sourceParams": {}
      }
      

      Create GSI index with :
      CREATE INDEX `idx2` ON `travel-sample`(`type`)

      Run explain of query : select meta().id from `travel-sample` USE INDEX (USING GSI, USING FTS) where country="France" and type = "airline"

      Query not doing IntersectScan on all qualified FTS, GSI Indexes, instead it goes only with GSI

      {
          "#operator": "Sequence",
          "~children": [
              {
                  "#operator": "IndexScan3",
                  "index": "idx2",
                  "index_id": "4a266e3fa666a7a9",
                  "index_projection": {
                      "primary_key": true
                  },
                  "keyspace": "travel-sample",
                  "namespace": "default",
                  "spans": [
                      {
                          "exact": true,
                          "range": [
                              {
                                  "high": "\"airline\"",
                                  "inclusion": 3,
                                  "low": "\"airline\""
                              }
                          ]
                      }
                  ],
                  "using": "gsi"
              },
              {
                  "#operator": "Fetch",
                  "keyspace": "travel-sample",
                  "namespace": "default"
              },
              {
                  "#operator": "Parallel",
                  "~child": {
                      "#operator": "Sequence",
                      "~children": [
                          {
                              "#operator": "Filter",
                              "condition": "(((`travel-sample`.`country`) = \"France\") and ((`travel-sample`.`type`) = \"airline\"))"
                          },
                          {
                              "#operator": "InitialProject",
                              "result_terms": [
                                  {
                                      "expr": "(meta(`travel-sample`).`id`)"
                                  }
                              ]
                          }
                      ]
                  }
              }
          ]
      }
      

      Attachments

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

        Activity

          People

            abhinav Abhi Dangeti
            girish.benakappa Girish Benakappa
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty