17

I'd like to be able to convert SQL Server query plans from XML to images. Ideally a vector format, but a bitmap would do.

Is there an open source library to do this? Or can I use one of the SQL Server Management Studio DLLs?

Thanks.

Ben Challenor
  • 3,365
  • 1
  • 35
  • 35
  • Just out of curiosity....What is the need for such an image generation? – Raja Mar 17 '10 at 13:14
  • It would be used in a product that would allow you to see plans that are currently performing badly, and to see how your plans have changed over time. As it would be external to SSMS, it would be nice to visualize them without needing to open them in SSMS. Having read the XSD, it doesn't look too complicated, so if all else fails I can do it myself. Thanks. – Ben Challenor Mar 18 '10 at 00:36
  • Wow...that seems to be a great idea....IMHO a pic is 100 times better than a paragraph. All the best and do post when you find a solution. – Raja Mar 18 '10 at 13:13
  • I have been looking for a while for this as well but I think making a screenshot would be much easier now than seeking a way to visualize the .sqlplan file without ssms. But if you got a solution, please do post here, thanks :) – schrodinger's code Mar 19 '10 at 13:57
  • Hey @BenChallenor, did you happen to create something for this? i need this :) – blogbydev Mar 15 '14 at 18:06
  • @suyash Sorry, unfortunately not; the code never saw the light of day. – Ben Challenor Mar 18 '14 at 22:10

1 Answers1

1

I have seen people do some pretty funky stuff with XSLT. The most impressive was a modifying CAD style XML output from one app to another for importing.

You could use XSLT to create WPF markup, or PostScript... There are a few options there...

Paul Kohler
  • 2,684
  • 18
  • 31
  • the problem is that how you can render the sqlplan xml like ssms does. – schrodinger's code Mar 19 '10 at 14:10
  • I'm marking this as the best answer as I'm pretty sure I'm going to have to do it myself. Having studied the schema further I agree that the algorithm could be represented as a functional transform on XML, but for my own sanity I will not use XSLT. ;) Thanks. – Ben Challenor Mar 22 '10 at 09:34
  • have you checked out that basic format, by using `set showplan_text on`, `go`, `some query` for example? – Paul Kohler Mar 22 '10 at 12:03
  • I have. It's more human-readable than the XML, but it's deprecated, and harder to parse than the XML. The XML schema is helpful here: http://schemas.microsoft.com/sqlserver/2004/07/showplan – Ben Challenor Mar 22 '10 at 20:51
  • 1
    [html-query-plan](http://code.google.com/p/html-query-plan/) uses XSLT to output a HTML representation of a query plan. – Justin Jun 04 '13 at 15:37