Presto: Add JSON format for EXPLAIN

Created on 3 Aug 2018  路  9Comments  路  Source: prestodb/presto

I'd like to add a JSON format for explain to make explain plans machine parseable. I would add the option to both explain and explain analyze. And the implementation would b in PlanPrinter (just like how TEXT and GRAPHVIZ are implemented)

The motivation is that I want a machine analyzable way to easily compare estimated costs and stats for a query with the actual performance results.

available-to-pickup beginner-task

Most helpful comment

Our team also like to have this feature. A machine readable explain analyze can help us better understand the type of query running in our cluster and figure out bottlenecks.

All 9 comments

The plan IR is not stable, so any such output would be subject to backward-incompatible changes from version to version.

Yes, agreed. it's not about committing to the output having particular fields, etc. it's that we want some way to get a representation that we can extract information from and analyze. If the IR changes, the JSON would be different and that's ok.

Our team also like to have this feature. A machine readable explain analyze can help us better understand the type of query running in our cluster and figure out bottlenecks.

And the implementation would b in PlanPrinter (just like how TEXT and GRAPHVIZ are implemented)

TEXT and GRAPHVIZ are heavily out of sync. Can we somehow prevent this from being true for TEXT and JSON as well?

Currently there are json versions of the plan as part of the queryCompletedEvent for a query, so it should be pretty straightforward to add this format for EXPLAIN.

This would be extraordinarily useful

Is anyone working on this? I would like to claim this issue if possible.

@chyikwei Currently we only support JSON format for EXPLAIN (TYPE IO, FORMAT JSON). It would be great if you can help us to extend it to other types! I assigned the task to you. Here's the commit that introduced JSON format to EXPLAIN IO for your reference: https://github.com/prestodb/presto/commit/60de647d8dd4225f94d727e6fd6e158742dcae3c

@rongrong thanks! Will check the reference commit you share.

Was this page helpful?
0 / 5 - 0 ratings