What does valueScan mean on explain plan when executing query

Hi

Can someone explain what does valueScan mean in the below explain Plan text?

{
  "#operator": "Sequence",
  "#stats": {
    "#phaseSwitches": 1,
    "execTime": "1.7µs"
  },
  "~children": [
    {
      "#operator": "Authorize",
      "#stats": {
        "#phaseSwitches": 3,
        "execTime": "10.9µs",
        "servTime": "1.212508ms"
      },
      "privileges": {
        "List": [
          {
            "Target": "default:prices",
            "Priv": 7
          }
        ]
      },
      "~child": {
        "#operator": "Sequence",
        "#stats": {
          "#phaseSwitches": 1,
          "execTime": "2.8µs"
        },
        "~children": [
          {
            "#operator": "Sequence",
            "#stats": {
              "#phaseSwitches": 2,
              "execTime": "151.301µs",
              "kernTime": "100ns",
              "state": "running"
            },
            "~children": [
              {
                **"#operator": "ValueScan",**
                "#stats": {
                  "#phaseSwitches": 1,
                  "execTime": "1µs"
                },
                "values": "[]",
                "#time_normal": "00:00",
                "#time_absolute": 0
              },
              {
                "#operator": "Fetch",
                "#stats": {
                  "#phaseSwitches": 3,
                  "execTime": "3µs",
                  "kernTime": "4.3µs"
                },
                "as": "priceChange",
                "keyspace": "prices",
                "namespace": "default",
                "#time_normal": "00:00",
                "#time_absolute": 0
              },
              {
                "#operator": "Sequence",
                "#stats": {
                  "#phaseSwitches": 2,
                  "execTime": "201.701µs",
                  "kernTime": "200ns",
                  "state": "running"
                },
                "~children": [
                  {
                    "#operator": "Filter",
                    "#stats": {
                      "#phaseSwitches": 3,
                      "execTime": "2.1µs",
                      "kernTime": "9.7µs"
                    },
                    "condition": "((((((`priceChange`.`_class`) in [\"XXXXXX\"]) and ((`priceChange`.`gtin`) = \"YYYYY\")) and ((`priceChange`.`locationClusterId`) = \"ZZZZZZ\")) and ((`priceChange`.`effectiveDateTime`) <= str_to_millis(\"2020-07-30T22:59Z\"))) and ((`priceChange`.`state`) in [\"APPROVED\"]))",
                    "#time_normal": "00:00.0000",
                    "#time_absolute": 0.0000021000000000000002
                  },
                  {
                    "#operator": "InitialProject",
                    "#stats": {
                      "#phaseSwitches": 7,
                      "execTime": "23.2µs",
                      "kernTime": "14.3µs"
                    },
                    "result_terms": [
                      {
                        "as": "_ID",
                        "expr": "(meta(`priceChange`).`id`)"
                      },
                      {
                        "as": "_CAS",
                        "expr": "(meta(`priceChange`).`cas`)"
                      },
                      {
                        "expr": "`priceChange`"
                      }
                    ],
                    "#time_normal": "00:00.0000",
                    "#time_absolute": 0.000023199999999999998
                  },
                  {
                    "#operator": "FinalProject",
                    "#stats": {
                      "#phaseSwitches": 1,
                      "execTime": "400ns"
                    },
                    "#time_normal": "00:00",
                    "#time_absolute": 0
                  }
                ],
                "#time_normal": "00:00.0002",
                "#time_absolute": 0.00020170099999999999
              }
            ],
            "#time_normal": "00:00.0001",
            "#time_absolute": 0.00015130099999999998
          },
          {
            "#operator": "Limit",
            "#stats": {
              "#phaseSwitches": 1,
              "execTime": "1.6µs"
            },
            "expr": "1",
            "#time_normal": "00:00.0000",
            "#time_absolute": 0.0000016000000000000001
          }
        ],
        "#time_normal": "00:00.0000",
        "#time_absolute": 0.0000028
      },
      "#time_normal": "00:00.0012",
      "#time_absolute": 0.001223408
    },
    {
      "#operator": "Stream",
      "#stats": {
        "#phaseSwitches": 3,
        "execTime": "3.2µs",
        "kernTime": "1.287009ms"
      },
      "#time_normal": "00:00.0000",
      "#time_absolute": 0.0000032000000000000003
    }
  ],
  "~versions": [
    "2.0.0-N1QL",
    "6.0.2-2413-enterprise"
  ],
  "#time_normal": "00:00.0000",
  "#time_absolute": 0.0000017
}

Regards,
Venkat

When query known keys it uses ValueScan (instead of indexscan ). i.e. USE KEYS or predicate evaluate FALSE without document.
ValueScan showing empty array. Share your entire query

@vsr1 just found that the issue is with the value passed in query

passing incorrect format - str_to_millis(“2020-07-30T22:59Z”) doing valueScan
passing correct format - str_to_millis(“2020-07-30T22:59:00Z”) doing indexScan

please identify extra 00 in the correct format

Sry for the confusion.

FYI: Incorrect format evaluates NULL. predicate f1 > NULL always false. i.e. WHERE false.

1 Like