JustinPealing / html-query-plan

Display SQL Server Execution Plans in HTML
MIT License
201 stars 43 forks source link

XML Plan to simple TEXT Plan #92

Open goranschwarz opened 3 years ago

goranschwarz commented 3 years ago

Any chance this project (in the future) also can compose a "simple text" plan from the XML Content like the output from set statistics profile on or similar!

That will be really helpful if you want to include a "showplan" output in any automatic warning mails (because mail content normally cant run JavaScript) I have a monitoring tool (DbxTune -- https://github.com/goranschwarz/DbxTune), and for SQL Server I use your tool to visualize captured showplans! But it also sends various alarms (vi mail or other methods), and in there I would like to have a "simpler text" representation of the plan, just to get a hint of what to plan does!

What do you think about this?

goranschwarz commented 3 years ago

As an "inspiration"... here are some examples from other vendors!

Oracle Explain output: https://blogs.oracle.com/optimizer/how-do-i-display-and-read-the-execution-plans-for-a-sql-statement

Postgres Explain output: https://thoughtbot.com/blog/reading-an-explain-analyze-query-plan https://www.postgresql.org/docs/9.4/using-explain.html

Sybase (or SQL Server version 4.2 and possibly 6.0 and 7.0): http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00743.1502/html/queryprocessing/queryprocessing45.htm

And another thing which might be of interest is to "visualize" Sybase XML Plans in the same way as you currently do (with html-query-plan) This is probably "out of scope" ... but for me it would be of interest :) http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36271.1570/html/blocks/blocks213.htm

goranschwarz commented 3 years ago

A easier alternative to "print" the plan as plain text, to include it into mail etc, would be to use "classic" html tables (which wont depends on JavaScript to draw the "arrows") See here for an example: https://blogs.sap.com/2013/06/15/graphical-html-query-plans-in-ase-157-sp100/

It sure isn't as good looking as the current output from html-query-plan, but alot of the XSLT code will be reusable (I tried to look at qp.xslt, but didn't really understand how to rewrite it into wrapped html tables)

I attached two HTML output files from a similar example as in the link above if it helps you :) ASE.html_showplan.html.txt ASE-2.html_showplan.html.txt