-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add media type for explain #2368
Conversation
5bcb9c6
to
ea3de6a
Compare
Some observations. The query identifier is included with the VERBOSE optioncurl 'localhost:3000/projects?id=lt.5' -H "Accept: application/vnd.pgrst.plan; options=verbose"[ { "Plan": { "Node Type": "Aggregate", "Strategy": "Plain", "Partial Mode": "Simple", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 24.25, "Total Cost": 24.28, "Plan Rows": 1, "Plan Width": 144, "Output": ["NULL::bigint", "count(ROW(projects.id, projects.name, projects.client_id))", "'{}'::text[]", "(COALESCE(json_agg(ROW(projects.id, projects.name, projects.client_id)), '[]'::j son))::character varying", "NULLIF(current_setting('response.headers'::text, true), ''::text)", "NULLIF(current_setting('response.status'::text, true), ''::text)"], "Plans": [ { "Node Type": "Bitmap Heap Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Relation Name": "projects", "Schema": "test", "Alias": "projects", "Startup Cost": 7.25, "Total Cost": 22.25, "Plan Rows": 400, "Plan Width": 40, "Output": ["projects.id", "projects.name", "projects.client_id"], "Recheck Cond": "(projects.id < 5)", "Plans": [ { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Index Name": "projects_pkey", "Startup Cost": 0.00, "Total Cost": 7.15, "Plan Rows": 400, "Plan Width": 0, "Index Cond": "(projects.id < 5)" } ] } ] }, "Query Identifier": 8960408738112779943 } ] Somehow the query identifier doesn't change unless the filter is changed. So doing an
So looks more like a plan identifier than a query identifier. Not really reliable to trace a request back to a query. The search_path is included with the SETTINGS optioncurl 'localhost:3000/projects?id=lt.5' -H "Accept: application/vnd.pgrst.plan; options=settings"[ { "Plan": { "Node Type": "Aggregate", "Strategy": "Plain", "Partial Mode": "Simple", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 24.25, "Total Cost": 24.28, "Plan Rows": 1, "Plan Width": 144, "Plans": [ { "Node Type": "Bitmap Heap Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Relation Name": "projects", "Alias": "projects", "Startup Cost": 7.25, "Total Cost": 22.25, "Plan Rows": 400, "Plan Width": 40, "Recheck Cond": "(id < 5)", "Plans": [ { "Node Type": "Bitmap Index Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Index Name": "projects_pkey", "Startup Cost": 0.00, "Total Cost": 7.15, "Plan Rows": 400, "Plan Width": 0, "Index Cond": "(id < 5)" } ] } ] }, "Settings": { "search_path": "\"test\", \"public\"" } } ]
This seems really useful for debugging as we have had questions about I guess this concern only applies if a production instance gets our EXPLAIN config enabled, which is likely. Perhaps we can recommend an additional measure: a It might also be worth considering tying the two together, i.e. enabling the plan media type like Specifying TIMING or WAL without ANALYZE gets a nice error message
Overall all the options seem pretty useful. I don't see why we should not expose all of them if we can ensure the callers are restricted. |
Also refactor Statements module types
Exposing COSTS is unnecessary because is already TRUE by default for all.
TIMING as well because requires ANALYZE and it's TRUE by default here.
SUMMARY ditto. It doesn't add any info on non-ANALYZE and it's already included for ANALYZE.
|
Added a plain text output to be compatible with https://explain.depesz.com/. The text output is really cool, same one as
|
I just skimmed the tests quickly, but couldn't find it: Do we already have the |
@wolfgangwalther Ah, no. I just left a note in the CHANGELOG(docs would be the same) that
|
Adding |
Closes #2354
TODO