sourcenetwork / defradb

DefraDB is a Peer-to-Peer Edge Database. It's the core data storage system for the Source Network Ecosystem, built with IPLD, LibP2P, CRDTs, and Semantic open web properties.
439 stars 43 forks source link

[Epic] Explain Request Functionality #35

Open jsimnz opened 2 years ago

jsimnz commented 2 years ago

Simple Explain SUB-TASKS (initial implementation will be verbose = true).

Debug Explain SUB-TASKS

Prediction Explain SUB-TASKS

Execution Explain SUB-TASKS

Bugs:

CHECKLIST:

DESCOPED:

DESCRIPTION

Implement an Explain API + Endpoint for returning the structure of a plan graph as generated by the planner package.

Request:

query @explain {
  user {
    _key
    age
    name
  }
}

Response:

{
  "data": [
    {
      "explain": {
        "selectTopNode": {
          "selectNode": {
            "filter": null,
            "scanNode": {
              "collectionID": "1",
              "collectionName": "user",
              "filter": null
            }
          }
        }
      }
    }
  ]
}

There should be additional data options. Such as ANALYZE (from SQL) which would actually execute the Request, and provide insights into perf analysis on a per node basis and EXECUTE to provide insights to what was actually executed.

There should be an additional option to change the verbosity level of explain to omit attributes like filter when they are null.

Output is only going to be in JSON.

jsimnz commented 2 years ago

https://github.com/sourcenetwork/defradb/blob/c1133123f1043229d9d645dfb3baff0950b24825/api/http/api.go#L1

shahzadlone commented 2 years ago

So pretty much like this example:

image

from: https://github.com/cockroachdb/cockroach/blob/master/docs/tech-notes/life_of_a_query.md

jsimnz commented 2 years ago

Spec doc: https://hackmd.io/BbMstl-9TE6n_Nq-5G8PRw?view