patternMinor
Oracle build_plan_xml visualizer
Viewed 0 times
oraclevisualizerbuild_plan_xml
Problem
Background: Please review my related question that involves SQL Server : Interpreting SQL Server's Showplan XML
I now have a very nice looking Execution Plan display for SQL Server (as a result of my previous question), and am hoping that lightning could strike twice here and that I might find a similarly high-quality solution for Oracle.
My site SQL Fiddle displays execution plans for each of the queries that you run on it, for each of the database types I support (at the moment - MS SQL, MySQL, PGSQL, and Oracle). The Oracle execution plan is built in this manner:
Where schema_short_code and query_id are obviously variables representing each distinct query. You can see the result of the above example running here: http://sqlfiddle.com/#!4/ee7da/596
This produces the following XML:
Although reading the raw XML is not terrible, it certainly does not look anywhere nearly as nice as what I now am able to show for SQL Server (compare by clicking "View Execution Plan" on this page: http://sqlfiddle.com/#!3/1fa93/1)
Has anyone worked with this XML before? Is it possible that someone might have built something close to what Justin built for SQL Server (see answerer for the SQL Server question)? If not, does anyone know where I can find some good direction for building my own XSLT (schema documentation, etc....), and possibly where I can look to
I now have a very nice looking Execution Plan display for SQL Server (as a result of my previous question), and am hoping that lightning could strike twice here and that I might find a similarly high-quality solution for Oracle.
My site SQL Fiddle displays execution plans for each of the queries that you run on it, for each of the database types I support (at the moment - MS SQL, MySQL, PGSQL, and Oracle). The Oracle execution plan is built in this manner:
explain plan set STATEMENT_ID = '#schema_short_code#/#query_id#' for
select id, type, details from supportContacts
/
select
dbms_xplan.build_plan_xml(statement_id => '#schema_short_code#/#query_id#').getclobval()
AS XPLAN
FROM dualWhere schema_short_code and query_id are obviously variables representing each distinct query. You can see the result of the above example running here: http://sqlfiddle.com/#!4/ee7da/596
This produces the following XML:
2
94
2
2
7501
00:00:01
SUPPORTCONTACTS
2
94
2
2
7501
00:00:01
"ID"[NUMBER,22], "TYPE"[VARCHAR2,20], "DETAILS"[VARCHAR2,40]
SEL$1
SUPPORTCONTACTS@SEL$1
11.2.0.2
2
2812004906
2012527029
Although reading the raw XML is not terrible, it certainly does not look anywhere nearly as nice as what I now am able to show for SQL Server (compare by clicking "View Execution Plan" on this page: http://sqlfiddle.com/#!3/1fa93/1)
Has anyone worked with this XML before? Is it possible that someone might have built something close to what Justin built for SQL Server (see answerer for the SQL Server question)? If not, does anyone know where I can find some good direction for building my own XSLT (schema documentation, etc....), and possibly where I can look to
Solution
I think you'd be better off using the text version of the explain plan output rather than XML, as it gives you a pre-formatted readable ascii representation of the query plan.
eg:
Failing that, if you have the means to do so server-side, you could use Oracle SQL Developer to give you a graphical representation of the query plan - Though this is really just the same as the ASCII version with a few icons.
Also, take a look at
eg:
SELECT * FROM TABLE(dbms_xplan.display('PLAN_TABLE','#schema_short_code#/#query_id#','ALL'));Failing that, if you have the means to do so server-side, you could use Oracle SQL Developer to give you a graphical representation of the query plan - Though this is really just the same as the ASCII version with a few icons.
Also, take a look at
$ORACLE_HOME/rdbms/xml/orarep/xplan/xplSch.xsd , $ORACLE_HOME/rdbms/xml/orarep/xplan/xplHtml.xsl and $ORACLE_HOME/rdbms/xml/xsl/kuplan.xsl - They may help you format your XML output to prettier HTML.Code Snippets
SELECT * FROM TABLE(dbms_xplan.display('PLAN_TABLE','#schema_short_code#/#query_id#','ALL'));Context
StackExchange Database Administrators Q#14878, answer score: 4
Revisions (0)
No revisions yet.