To start the analysis of the plan, you need to send a POST-request to /explain request to explain with
the body of the plan and additional call parameters in the form of a JSON object.
An example to call with CURL:
curl -X POST https:///explain \
-H "Content-Type: application/json" \
-d @FILENAME
here FILENAME is the path to the file containing the call parameters as a JSON object
Response format
The positive processing result is returned with the code HTTP 302 .
In the heading Location returns the URL of the renderer of the rendered plan, including its uuid :
/archive/explain/42453282d5fc9c05d637372d3851165d:0:2021-08-03
Request parameters
required |
plan |
string |
plan in text / JSON / YAML format as a single line |
optional |
name |
string |
the name of the plan in the archive |
private |
boolean |
plan is visible only in personal archive, default: false |
associated query |
query |
string |
the text of the associated query |
params |
string |
$ n-parameters as a single line |
plan tree |
group |
UUID(string) |
group root plan ID |
parent |
UUID(string) |
parent plan ID |
Request examples
simple plan |
{
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)"
} |
named plan |
{
"name" : "Plan-name",
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)"
} |
associated query |
{
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)",
"query" : "SELECT * FROM pg_class WHERE oid = 'pg_class'::regclass"
} |
parameterized query |
{
"plan" : "Bitmap Heap Scan on pg_class (cost=503.84..1720.79 rows=4781 width=265)\n Recheck Cond:
(relnamespace ='99'::oid)\n Filter: (relowner = '10'::oid)\n -> Bitmap Index Scan on
pg_class_relname_nsp_index (cost=0.00..502.64 rows=4781 width=0)\n Index Cond: (relnamespace = '99'::oid)",
"query" : "SELECT * FROM pg_class WHERE relnamespace = $1 and relowner = $2",
"params" : "$1=100,$2=10"
} |
adding to the tree |
{
"name" : "Plan-name1",
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)",
"query" : "SELECT * FROM pg_class",
} -> UUID:8cf81ae6-0ccf-fe5f-b0e7-529b5b1e4328 |
{
"name" : "Plan-name2",
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)",
"query" : "SELECT * FROM pg_class",
"group" : "8cf81ae6-0ccf-fe5f-b0e7-529b5b1e4328",
"parent": "8cf81ae6-0ccf-fe5f-b0e7-529b5b1e4328"
} -> UUID: 12345ae6-0ccf-fe5f-b0e7-529b5b1e4328" |
{
"name" : "Plan-name3",
"plan" : "Index Scan using pg_class_oid_index on pg_class\n Index Cond: (oid = '1259'::oid)",
"query" : "SELECT * FROM pg_class",
"group" : "8cf81ae6-0ccf-fe5f-b0e7-529b5b1e4328",
"parent": "12345ae6-0ccf-fe5f-b0e7-529b5b1e4328"
} -> UUID: 98765ae6-0ccf-fe5f-b0e7-529b5b1e4328" |