patternsqlMinor
Does SQL Server Management Studio 2017 Contain a New Explain Feature
Viewed 0 times
newserversqlcontaindoesstudiomanagementexplain2017feature
Problem
TL;DR
I happened upon a feature in SQL Server Management Studio v17.9 which I was not aware of. It looks a bit like the
How to Turn The Feature On
I was running the following query with the options Include Actual Execution Plan (Ctrl + M) and Include Live Query Statistics turned on:
SELECT sdes.session_id
,sdes.[status]
,sdes.login_name
,sdes.[host_name]
,sder.blocking_session_id
,sdb.name
,sdes.cpu_time
,sdes.logical_reads --optionally: + sdes.reads + sdes.writes
,sdes.last_request_start_time
,sdes.program_name
,sdes.session_id
,sder.request_id
,dest.[text]
FROM sys.dm_exec_sessions AS sdes
LEFT JOIN sys.dm_exec_connections AS sdec
ON sdes.session_id = sdec.session_id
JOIN sys.databases AS sdb
ON sdes.database_id = sdb.database_id
LEFT JOIN sys.dm_exec_requests AS sder
ON sdes.session_id = sder.session_id
CROSS APPLY sys.dm_exec_sql_text(sdec.most_recent_sql_handle) AS dest
WHERE 1=1
AND sdb.name = ''
Outcome
This produced four results tabs:
Special Results Tab
When I switched to the Results tab, I noticed a result set just below the actual results which looks like this:
Observations
If I turn on either the Include Actual Execution Plan (Ctrl + M) option or the Include Live Query Statistics option, then the SQL Server Explain isn't displayed. The "SQL Server Explain" is only displayed if both options are turned on.
Questions
Prerequisites
The follo
I happened upon a feature in SQL Server Management Studio v17.9 which I was not aware of. It looks a bit like the
EXPLAIN found in Oracle, PostgreSQL and MySQL. Where is this feature documented?How to Turn The Feature On
I was running the following query with the options Include Actual Execution Plan (Ctrl + M) and Include Live Query Statistics turned on:
SELECT sdes.session_id
,sdes.[status]
,sdes.login_name
,sdes.[host_name]
,sder.blocking_session_id
,sdb.name
,sdes.cpu_time
,sdes.logical_reads --optionally: + sdes.reads + sdes.writes
,sdes.last_request_start_time
,sdes.program_name
,sdes.session_id
,sder.request_id
,dest.[text]
FROM sys.dm_exec_sessions AS sdes
LEFT JOIN sys.dm_exec_connections AS sdec
ON sdes.session_id = sdec.session_id
JOIN sys.databases AS sdb
ON sdes.database_id = sdb.database_id
LEFT JOIN sys.dm_exec_requests AS sder
ON sdes.session_id = sder.session_id
CROSS APPLY sys.dm_exec_sql_text(sdec.most_recent_sql_handle) AS dest
WHERE 1=1
AND sdb.name = ''
Outcome
This produced four results tabs:
- Results
- Messages
- Live Query Statistics
- Execution Plan
Special Results Tab
When I switched to the Results tab, I noticed a result set just below the actual results which looks like this:
Observations
If I turn on either the Include Actual Execution Plan (Ctrl + M) option or the Include Live Query Statistics option, then the SQL Server Explain isn't displayed. The "SQL Server Explain" is only displayed if both options are turned on.
Questions
- Can this feature be turned on without having to activate both Include Actual Execution Plan (Ctrl + M) option and the Include Live Query Statistics?
- Where is this neat little feature documented?
Prerequisites
The follo
Solution
No, not a feature - it's turning one of these on:
The SHOWPLAN_TEXT option and STATISTICS PROFILE option are well-documented and have been around for over a decade, but I don't know when SSMS started turning it on for the combo of live query plans and actual plans. I would consider it a bug.
Here's the SSMS bug I filed for it.
SET SHOWPLAN_TEXT ON;
SET STATISTICS PROFILE ON;The SHOWPLAN_TEXT option and STATISTICS PROFILE option are well-documented and have been around for over a decade, but I don't know when SSMS started turning it on for the combo of live query plans and actual plans. I would consider it a bug.
Here's the SSMS bug I filed for it.
Code Snippets
SET SHOWPLAN_TEXT ON;
SET STATISTICS PROFILE ON;Context
StackExchange Database Administrators Q#223647, answer score: 6
Revisions (0)
No revisions yet.