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

Include N1QL(SQL) statement within the Explain plan.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • feature-backlog
    • 4.0.0
    • query
    • Security Level: Public
    • None
    • Untriaged
    • Unknown

    Description

      Explain has all the other info about the statement, except the statement itself.
      It's a bit easier to collect the explain in a script if the statement is also available within the explain.

      cbq> explain select C_STATE, C_CREDIT, avg(C_CREDIT_LIM) as AVG_CR_LIMIT from CUSTOMER group by C_STATE, C_CREDIT ORDER BY AVG_CR}
      {
      "requestID": "b9c8490c-ae00-4cb0-a35f-84292ed9864b",
      "signature": "json",
      "results": [
      {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "PrimaryScan", "index": "#primary", "keyspace": "CUSTOMER", "namespace": "default", "using": "view" }

      ,
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "Fetch", "keyspace": "CUSTOMER", "namespace": "default" }

      ,

      { "#operator": "InitialGroup", "aggregates": [ "avg((`CUSTOMER`.`C_CREDIT_LIM`))" ], "group_keys": [ "(`CUSTOMER`.`C_STATE`)", "(`CUSTOMER`.`C_CREDIT`)" ] }

      ,

      { "#operator": "IntermediateGroup", "aggregates": [ "avg((`CUSTOMER`.`C_CREDIT_LIM`))" ], "group_keys": [ "(`CUSTOMER`.`C_STATE`)", "(`CUSTOMER`.`C_CREDIT`)" ] }

      ]
      }
      },

      { "#operator": "IntermediateGroup", "aggregates": [ "avg((`CUSTOMER`.`C_CREDIT_LIM`))" ], "group_keys": [ "(`CUSTOMER`.`C_STATE`)", "(`CUSTOMER`.`C_CREDIT`)" ] }

      ,

      { "#operator": "FinalGroup", "aggregates": [ "avg((`CUSTOMER`.`C_CREDIT_LIM`))" ], "group_keys": [ "(`CUSTOMER`.`C_STATE`)", "(`CUSTOMER`.`C_CREDIT`)" ] }

      ,
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "InitialProject",
      "result_terms": [

      { "expr": "(`CUSTOMER`.`C_STATE`)" }

      ,

      { "expr": "(`CUSTOMER`.`C_CREDIT`)" }

      ,

      { "as": "AVG_CR_LIMIT", "expr": "avg((`CUSTOMER`.`C_CREDIT_LIM`))" }

      ]
      }
      ]
      }
      }
      ]
      },
      {
      "#operator": "Order",
      "sort_terms": [

      { "desc": true, "expr": "`AVG_CR_LIMIT`" }

      ]
      },
      {
      "#operator": "Parallel",
      "~child":

      { "#operator": "FinalProject" }

      }
      ]
      }
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "12.271111ms", "executionTime": "12.207359ms", "resultCount": 1, "resultSize": 4762 }

      }

      cbq>

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            gerald Gerald Sangudi (Inactive)
            keshav Keshav Murthy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty