Hidden Gems of SQL Server
2019
Odessa .Net User Group
Denis Reznik
Data Architect at Intapp, Inc.
Microsoft Data Platform MVP
About Me
• Denis Reznik
• Kyiv, Ukraine
• Data Architect at Intapp, Inc.
• Microsoft Data Platform MVP
• Co-Founder of Ukrainian Data Community Kyiv (PASS Chapter)
• PASS Regional Mentor, Central and Eastern Europe
• Co-author of “SQL Server MVP Deep Dives vol. 2”
SQL Server 2019
• Killer Features
• Big Data Clusters
• Secure Enclaves
• Intelligent QP
• Java Support
• String Truncation Error
Message (the most known
“hidden” feature)
• Hidden Features
• Lightweight Query Profiling
• DBCC PAGE
• dm_os_host_info
• dm_os_schedulers
• QUERY OPTIMIZER
COMPATIBILITY LEVEL
Lightweight Profiling
Session Level
Lightweight Profiling
• SQL Server 2014 – sys.dm_exec_query_profiles
• SQL Server 2016/2014 SP1 – Live Query Statistics
• Enable LQS in SSMS
• SET STATISTICS XML ON
• SET STATISTICS PROFILE ON
• query_post_execution_showplan event
• SQL Server 2016/2014 SP2 - query_thread_profile event
• SQL Server 2016 SP1 – query_thread_profile/TF 7412
• Lightweight query execution profiling
• https://blogs.msdn.microsoft.com/sql_server_team/query-progress-anytime-anywhere/
Server Level
DEMO
Lightweight Profiling
DEMO
DBCC PAGE
Global Allocation MAP (GAM)
GAM
Extent 1
Query 1
Query 2
LATCH
Wait
Extent 2
GAM 2 GAM 3
… …4GB 4GB
DEMO
dm_os_host_info
dm_os_schedulers
Query Execution
Thread Pool
Running
Suspended
Runnable
Scheduler
Logical CPU
Worker (Thread)
Connection
DEMO
dm_os_schedulers
QUERY OPTIMIZER COMPATIBILITY LEVEL
Statistics
500
1000
10
1200
800
1 800 2000 2800 4500 5400
SELECT * FROM Users
WHERE Id BETWEEN 2100 AND 2500
SELECT * FROM Users
WHERE Id BETWEEN 200 AND 5000
500
1000
10
1200
800
1 800 2000 2800 4500 5400
Statistics
SELECT * FROM Users u
INNER JOIN Posts p
ON u.Id = p.OwnerUserId
WHERE u.DisplayName LIKE 'Jeff%'
10600
20000 10
1200 800
A G L S T ZZZZ
Users
Posts
DEMO
QUERY OPTIMIZER COMPATIBILITY LEVEL
SUMMARY
• Truncation Error Message (the most known “hidden” feature)
• Lightweight Query Profiling
• DBCC PAGE
• dm_os_host_info
• dm_os_schedulers
• QUERY OPTIMIZER COMPATIBILITY LEVEL
• More hidden features are coming..
Thank You!
Denis Reznik
Twitter: @denisreznik
Email: denisreznik@gmail.com
Blog: http://reznik.uneta.com.ua
Facebook: https://www.facebook.com/denis.reznik.5
LinkedIn: http://ua.linkedin.com/pub/denis-reznik/3/502/234

Odessa .net-user-group-sql-server-2019-hidden-gems by Denis Reznik

  • 1.
    Hidden Gems ofSQL Server 2019 Odessa .Net User Group Denis Reznik Data Architect at Intapp, Inc. Microsoft Data Platform MVP
  • 2.
    About Me • DenisReznik • Kyiv, Ukraine • Data Architect at Intapp, Inc. • Microsoft Data Platform MVP • Co-Founder of Ukrainian Data Community Kyiv (PASS Chapter) • PASS Regional Mentor, Central and Eastern Europe • Co-author of “SQL Server MVP Deep Dives vol. 2”
  • 3.
    SQL Server 2019 •Killer Features • Big Data Clusters • Secure Enclaves • Intelligent QP • Java Support • String Truncation Error Message (the most known “hidden” feature) • Hidden Features • Lightweight Query Profiling • DBCC PAGE • dm_os_host_info • dm_os_schedulers • QUERY OPTIMIZER COMPATIBILITY LEVEL
  • 4.
  • 5.
    Session Level Lightweight Profiling •SQL Server 2014 – sys.dm_exec_query_profiles • SQL Server 2016/2014 SP1 – Live Query Statistics • Enable LQS in SSMS • SET STATISTICS XML ON • SET STATISTICS PROFILE ON • query_post_execution_showplan event • SQL Server 2016/2014 SP2 - query_thread_profile event • SQL Server 2016 SP1 – query_thread_profile/TF 7412 • Lightweight query execution profiling • https://blogs.msdn.microsoft.com/sql_server_team/query-progress-anytime-anywhere/ Server Level
  • 6.
  • 7.
  • 8.
    Global Allocation MAP(GAM) GAM Extent 1 Query 1 Query 2 LATCH Wait Extent 2 GAM 2 GAM 3 … …4GB 4GB
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
    Statistics 500 1000 10 1200 800 1 800 20002800 4500 5400 SELECT * FROM Users WHERE Id BETWEEN 2100 AND 2500 SELECT * FROM Users WHERE Id BETWEEN 200 AND 5000
  • 15.
    500 1000 10 1200 800 1 800 20002800 4500 5400 Statistics SELECT * FROM Users u INNER JOIN Posts p ON u.Id = p.OwnerUserId WHERE u.DisplayName LIKE 'Jeff%' 10600 20000 10 1200 800 A G L S T ZZZZ Users Posts
  • 16.
  • 17.
    SUMMARY • Truncation ErrorMessage (the most known “hidden” feature) • Lightweight Query Profiling • DBCC PAGE • dm_os_host_info • dm_os_schedulers • QUERY OPTIMIZER COMPATIBILITY LEVEL • More hidden features are coming..
  • 18.
    Thank You! Denis Reznik Twitter:@denisreznik Email: denisreznik@gmail.com Blog: http://reznik.uneta.com.ua Facebook: https://www.facebook.com/denis.reznik.5 LinkedIn: http://ua.linkedin.com/pub/denis-reznik/3/502/234