plan_explain

The checked plan with derived schemas, cache keys and chosen algorithms.

QueryDeterministic

Flags

Flag Value
Kind query: reads values
Rows one result, not a table
Deterministic yes
Order matters no
Decomposable no
Makes no value

Parameters

Parameter Type Required Notes
plan object yes
inputs map of reference | object no
response_format "concise" | "detailed" no The byte budget: 64 KiB concise, 512 KiB detailed.

Example

Over the example tables orders; ${input:name} is an input's reference and ${verb} the value an earlier call made.

JSON
plan_explain {
  "plan": {
    "version": "hint.plan/1",
    "nodes": [
      {
        "id": "r",
        "op": "read",
        "params": {
          "input": "t"
        }
      },
      {
        "id": "f",
        "op": "filter",
        "inputs": [
          "r"
        ],
        "params": {
          "predicate": {
            "fn": "eq",
            "args": [
              {
                "col": 7
              },
              {
                "lit": "paid",
                "type": {
                  "kind": "utf8"
                }
              }
            ]
          }
        }
      }
    ],
    "outputs": {
      "paid": "f"
    }
  },
  "inputs": {
    "t": "${input:orders}"
  }
}

Result

explained

JSON
{
  "planHash": "sha256:755f95391a074a5b704540cce33798c4fb620e29ac1cc147fcee0b6e3fd9b004",
  "nodes": "…",
  "outputs": {
    "paid": "f"
  },
  "canonical": {
    "version": "hint.plan/1",
    "nodes": [
      {
        "id": "n0",
        "op": "read",
        "inputs": [],
        "params": {
          "input": "t"
        }
      },
      {
        "id": "n1",
        "op": "filter",
        "inputs": [
          "n0"
        ],
        "params": {
          "predicate": {
            "fn": "eq",
            "args": [
              {
                "col": 7
              },
              {
                "lit": "paid",
                "type": {
                  "kind": "utf8"
                }
              }
            ]
          }
        }
      }
    ],
    "outputs": {
      "paid": "n1"
    }
  },
  "text": "…"
}

Diagnostics

A refusal comes back as ok: false with coded diagnostics; every code, with its fix, is on the diagnostics page. A parameter that does not match the schema above is ARG_INVALID, with the parameter's path.