Alguém conhece uma maneira de converter o texto legado do showplan em um formato gráfico?
Em outras palavras, posso pegar o StmtText retornado de SET SHOWPLAN_TEXT ON e convertê-lo para me mostrar um plano de execução gráfico? Eu precisaria analisá-lo em XML e no formato .sqlplan para ver o gráfico?
Eric:, aqui está o exemplo, executado no AdventureWorks:
SET SHOWPLAN_TEXT ON
GO
SELECT c.CustomerID, soh.ShipDate
FROM Sales.SalesOrderDetail sod
INNER JOIN Sales.SalesOrderHeader soh ON sod.SalesOrderID = soh.SalesOrderID
INNER JOIN Sales.Customer c ON c.CustomerID = soh.CustomerID
WHERE sod.SpecialOfferID = 2
AND soh.ShipDate between '2003-01-01 00:00:00.000' and '2004-01-01 00:00:00.000'
AND c.CustomerType = 'I'
E você verá este StmtText retornado:
StmtText
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Hash Match(Inner Join, HASH:([soh].[CustomerID])=([c].[CustomerID]))
|--Hash Match(Inner Join, HASH:([sod].[SalesOrderID])=([soh].[SalesOrderID]))
| |--Index Seek(OBJECT:([AdventureWorks].[Sales].[SalesOrderDetail].[ix_nc_SpecialOfferID_inc_SalesOrderID] AS [sod]), SEEK:([sod].[SpecialOfferID]=(2)) ORDERED FORWARD)
| |--Index Seek(OBJECT:([AdventureWorks].[Sales].[SalesOrderHeader].[ix_nc_ShipDate_inc_SalesOrderID_CustomerID] AS [soh]), SEEK:([soh].[ShipDate] >= '2003-01-01 00:00:00.000' AND [soh].[ShipDate] <= '2004-01-01 00:00:00.000') ORDERED FORWARD)
|--Index Seek(OBJECT:([AdventureWorks].[Sales].[Customer].[ix_nc_CustomerType] AS [c]), SEEK:([c].[CustomerType]=N'I') ORDERED FORWARD)