SQL Server Query Tree Viewer

This is a completely free educational tool that can be used to visualize query trees within SQL Server and to display internal optimizer information. See Get Your Optimizer to Give up All Its Secrets for more information.

This is beta software, and I hope to be adding improvements over the coming months. Note that .NET Framework 4.5 must be installed on your machine to be able to use the program.

Note: Up to version 0.6 this was called SQL Server Parse Tree Viewer. I changed the name in December 2016 to more accurately reflect what the tool does.

Example

As a very simple example, you can use to tool to connect to copy of the CorpDB sample database. Paste in and execute the following query:

dbcc traceon (3604);
 
select c.CustomerID, c.FirstName, c.LastName, c.Address, c.City, c.State, oh.OrderId, oh.OrderDate
from CorpDB.dbo.OrderHeader oh
inner join CorpDB.dbo.Customer c on c.CustomerID = oh.CustomerId
where c.State = 'WY'
option (recompile, querytraceon 8605, querytraceon 8606);

SSQTV will display the various query trees generated by the optimizer. For instance, the simplified tree is displayed as shown below.

Binaries

Current version: ssqtv-0.10.zip (133KB) (September 2019)

Previous versions:

Installation

Extract the contents of the ZIP file into a directory of your choice, then run SqlServerQueryTreeViewer.exe.

Source Code

The source code is available on GitHub.

Licensed under the MIT License


Copyright(c) 2016-2019 Brian Hansen.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.