Skip to content

SQL Server 2016: Live query statistics

During my tests of the SQL Server 20126 CTP2, I noticed an additional icon on SQL Server Management studio which is close to the Actual Execution Plan button as shown below:

blog_48_-_1_-_query_live_statistics_icon

I decided to take a look at the SQL Server 2016 BOL and I found a topic about this feature. It seems to be a funny feature. So after that, I decided to test it with one of my financial query (developed for one of my customer) which usually takes a long time to run.

Let’s go ahead and after running my long query, this first test was in fact inconclusive because after opening a new tab, I got stuck with the following message even after stopping my query execution:

blog_48_-_2_-_message_waiting_for_a_query_plan

Maybe my query is too complex and I have to investigate in a near future. Updated 04.06.2015: It seems that it is a bug with this current release of SQL Server 2016 (CTP2). So I will try later with maybe, the next CTP.

Let’s continue by cutting out my big query into smaller pieces of code and the test ran successfully this time. Indeed, I was able to see a “progressive” query plan where we can see how long operators are taking as well as how far they are in their operations with some awesome animation.

blog_48_-_5_-_live_query_statistics

Basically, we get an “enhanced” execution plan tree. The dotted lines point out the operations in progress with some additional information as the current duration for each operator. Likewise, we may retrieve all other usual information that concern a query execution plan.

However, I noticed during my tests that the percentage calculation didn’t work on the operators if the row estimate is not correct (it will get stuck on 100% while the time keeps ticking away). At this point, I remembered that I faced the same problem with the DMV sys.dm_exec_query_profiles introduced by SQL Server 2014 (please take a look at my blog post here). Let’s perform the same test by using the sys.dm_exec_query_profiles DMV and as excepted I noticed the same duration issue when cardinality estimation was wrong.

blog_48_-_4_-_sys_dm_exec_query_stats

I guess we will learn better in the future about this interesting feature. We’re certainly on the good way in order to detect expensive operations just by looking at the pretty cool animation!

By David Barbarin

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Microsoft Team

Microsoft Team

Posts published under the Microsoft Team account are collective contributions by the dbi services Microsoft consultants. The practice covers SQL Server across its lifecycle, from installation, migration, and security to high availability with Always On and performance tuning, together with Azure data services and the Microsoft Business Intelligence stack, including Power BI. The team holds Microsoft certifications up to Expert level and operates customer platforms under service level agreements.View Author posts

263 posts since October 2011

Leave a Comment

Your email address will not be published. Required fields are marked *