bobward@microsoft.com
https://blogs.msdn.microsoft.com/sql_server_team
SQL Server
Engine
286 System
Catalog Views
232 Dynamic
Management
Views
(Functions)
~1300
Extended
Events
2100
Performance
Monitor
Counters
Extensive
SHOWPLAN
statistics and
warnings
ERRORLOG,
Event Log,
System Health
Session
backup_restore_progress_trace event
“database recovery progress” events
dm_exec_input_buffer
ALTER
DATABASE SCOPED
CONFIGRUATION
list
columnstore
In-Memory
OLTP
Always
Encrypted
Feature
RTM SP1
Standard Web Express Standard Web Express
Row-level security Yes No No Yes Yes Yes
Dynamic Data Masking Yes No No Yes Yes Yes
Change data capture* No No No Yes Yes No*
Database snapshot No No No Yes Yes Yes
Columnstore No No No Yes Yes Yes
Partitioning No No No Yes Yes Yes
Compression No No No Yes Yes Yes
In Memory OLTP No No No Yes Yes Yes
Always Encrypted No No No Yes Yes Yes
PolyBase No No No Yes Yes Yes
Fine grained auditing No No No Yes Yes Yes
Multiple filestream containers No No No Yes Yes Yes
* Requires SQL Server Agent which is not part of SQL Server Express Editions.
SQL Server 2016 SP1 Edition Max Buffer pool size per instance In-Memory OLTP quota (per DB)
Express 1410MB 352MB
Web 64GB 16GB
Standard 128GB 32GB
Developer Unlimited (OS Max of 24TB) Unlimited (OS Max of 24TB)
Enterprise Unlimited (OS Max of 24 TB) Unlimited (OS Max of 24TB)
SQL Server 2016 SP1
Edition
Columnstore memory limit (per
instance)
MAXDOP
Aggregate
pushdown
Filter
pushdown
SIMD support
Express 256MB 1 N N N
Web 16GB 1 N N N
Standard 32GB 2 N N N
Developer Unlimited (OS Max of 24TB) Unlimited Y Y Y
Enterprise Unlimited (OS Max of 24TB) Unlimited Y Y Y
In-Memory OLTP
Columnstore
Understanding the Memory limits for non-EE
editions of SQL Server
Edition limits only impact
buffer pool memory
Advanced R integration and Standalone R Server
Polybase head node
Master Data Services and Data Quality Services
Resource Governor and IO Resource Governor
Partition Table Parallelism
Full NUMA capabilities
Star join query optimizations
Parallel query processing on partitioned tables and indexes
Scalability and Performance in Enterprise Edition
Global batch aggregation
Distributed partitioned views
Online index operations
Auto use of indexed views
Parallel CHECKDB
Advanced scanning for disk-based tables
I found the query with
the problem, now
what do I do?
I have “runaway”
queries
Why isn’t this seek
working?
Regular Query
Profiling
Full runtime statistics for a query plan
Most expensive overhead
Can be enabled per session or global
Consume data from live queries or post
execution
Lightweight Query
Profiling
Limited runtime statistics in query plan
Least expensive overhead
Only enabled globally only
Consume data from live queries or post
execution
We optimized this even further in SQL Server
2016 SP1
SET “option” output
XEvent
• query_post_execution_showplan
• query_thread_profile
DMVs
• dm_exec_query_profiles
• dm_exec_query_statistics_xml
SSMS
• Include Actual Plan
• Include Live Statistics
• Activity Monitor
XEvent
• query_thread_profile
DMVs
• dm_exec_query_profiles
• dm_exec_query_statistics_xml
SSMS
• Activity Monitor
• Include Live Statistics (through AM)
• SET STATISTICS XML (or Include
Actual Plan) still uses regular
query profiling
• query_post_execution_showplan
still uses regular query profiling
• query_thread_profile event is
Debug Channel and does not
include query plan
Overhead percent (up to)
Infra Type
no active
xEvents
Active xEvent
query_post_execution_showplan
Regular (Legacy) 75.5 93.17
Lightweight in SQL Server 2014
SP2/2016
3.5 62.02
Lightweight in SQL Server 2016 SP1 2 14.3
• Information about parameters data type
• CPU and execution elapsed time for entire query (root node)
• Top waits (using sys.dm_exec_session_wait_stats)
• Per operator performance
statistics for node and
threads
• Showplan extended to
include
RunTimeCountersPerThread
• Node costs for parent and
children:
• Cumulative values for Row mode operators
• Singleton values for Batch mode operators
Detailed runtime stats we now provide
Runtime Info Up to SQL 2016 SQL 2016 / SQL 2014 SP2 SQL 2016 SP1
ActualRows X X X
ActualRowsRead X X
Batches X X
ActualEndOfScans X X X
ActualExecutions X X X
ActualExecutionMode X X
ActualElapsedms X X
ActualCPUms X X
ActualScans X X
ActualLogicalReads X X
ActualPhysicalReads X X
ActualReadAheads X X
ActualLobLogicalReads X X
ActualLobPhysicalReads X X
ActualLobReadAheads X X
InputMemoryGrant X
OutputMemoryGrant X
UsedMemoryGrant X
Searching with pushdown
SELECT [ProductID]
FROM [Sales].[SalesOrderDetail]
WHERE [ModifiedDate] BETWEEN '2011-01-01' AND '2012-01-01'
AND [OrderQty] >= 10
ModifiedDate ProductID StoreID OrderQty SalesAmount
2010-12-31 106 01 12 30
2011-01-07 103 04 1 17
2011-01-07 109 04 7 20
2011-02-12 103 03 5 40
2011-03-08 106 05 7 25
2011-04-16 106 02 10 40
2011-07-20 102 02 12 50
2011-10-21 106 03 16 55
2011-12-15 103 03 20 55
(…) (…) (…) (…) (…)
2012-01-01 109 01 11 16
2012-01-11 102 05 5 10
Sales.SalesOrderDetail
ModifiedDate ProductID StoreID OrderQty SalesAmount
2010-12-31 106 01 12 30
2011-01-07 103 04 1 17
2011-01-07 109 04 7 20
2011-02-12 103 03 5 40
2011-03-08 106 05 7 25
2011-04-16 106 02 10 40
2011-07-20 102 02 12 50
2011-10-21 106 03 16 55
2011-12-15 103 03 20 55
(…) (…) (…) (…) (…)
2012-01-01 109 01 11 16
2012-01-11 102 05 5 10
ModifiedDate ProductID StoreID OrderQty SalesAmount
2011-04-16 106 02 10 40
2011-07-20 102 02 12 50
2011-10-21 106 03 16 55
2011-12-15 103 03 20 55
(…) (…) (…) (…) (…)
2012-01-01 109 01 11 16
Result Set
Actual
Rows
• In SQL Server 2016, 2014 SP2
and 2012 SP3
• New Showplan attribute
ActualRowsRead:
• This attribute provides information about how many
rows were read by the operator before the residual
predicate was applied.
• You get this information from Actual Execution Plan.
• sys.dm_exec_query_profiles DMV exposes new
column actual_read_row_count.
Predicate Pushdown in Showplan
• In SQL Server 2016 SP1
• New Showplan attribute
EstimatedRowsRead:
• This attribute provides information about how
many rows are estimated to be read by the
operator before the residual predicate is applied.
• You get this information from Estimated Execution
Plan.
• sys.dm_exec_query_profiles DMV exposes new
column estimated_read_row_count.
Predicate Pushdown in Showplan
SELECT AddressID
FROM Person.[Address]
WHERE City = N'Ballard'
AND [PostalCode] = '98107'
OPTION (QUERYTRACEON 9481)
SELECT AddressID
FROM Person.[Address]
WHERE City = N'Ballard'
AND [PostalCode] = '98107'
OPTION (USE HINT('FORCE_LEGACY_CARDINALITY_ESTIMATION'))
USE HINT TF DB Option
DISABLE_OPTIMIZED_NESTED_LOOP 2340
FORCE_LEGACY_CARDINALITY_ESTIMATION 9481 Yes
ENABLE_QUERY_OPTIMIZER_HOTFIXES 4199 Yes
DISABLE_PARAMETER_SNIFFING 4136 Yes
ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES
4137 for OldCE
9471 for NewCE
DISABLE_OPTIMIZER_ROWGOAL 4138
ENABLE_HIST_AMENDMENT_FOR_ASC_KEYS 4139
ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS 9476 on NewCE
FORCE_DEFAULT_CARDINALITY_ESTIMATION 2312
•KB 3190548CREATE OR ALTER statement
•KB 3191273 and 3191273Self-Referential Integrity operator
•KB 3170114dm_db_incremental_stats_properties
•3191296Track TLS protocol with trace xEvent
Database Number of Objects SSMS sp_clonedatabase DBCC CLONEDATABASE
Large Bank DB 20453 Scripting error 378 seconds* 33 seconds (11x)
Internal MS DB 80819 OOM 1200 seconds* 24 seconds (50x)
ERP DB 1008002 OOM 7200 seconds* 122 seconds (60x)
3177838
Blog post on
security
Blog post on
columnstore
Not for
production
1 = Conventional Memory Model
2 = Lock Pages in Memory
3 = Large Pages in Memory
here
recovery_unit_harden_log_timestamps
log_block_pushed_to_logpool
hadr_logblock_compression
hadr_log_block_decompression
hadr_transport_receive_log_block_message
hadr_log_block_group_commit
hadr_capture_filestream_wait
hadr_lsn_send_complete
hadr_receive_harden_lsn_message
KB
3173156
KB
3170123
KB
3173157
Query Store Memory Leak
AV for spatial query exec or XML plan
Tempdb sysobjvalues latch increase
In-Memory OLTP checkpoint files
Adaptive QP
Automatic Query
Plan Tuning
Ensuring our
Diagnostics on
Linux are best in
class
New Query Store
Reports in SSMS
v17.0
SQL Server Tiger Team Blog
Tiger Toolbox GitHub
SQL Server Release Blog
BP Check
SQL Server Standards Support
Trace Flags
SQL Server Support lifecycle
SQL Server Updates
Twitter
Enhancements that will make your sql database roar sp1 edition sql bits 2017

Enhancements that will make your sql database roar sp1 edition sql bits 2017

  • 1.
  • 4.
    SQL Server Engine 286 System CatalogViews 232 Dynamic Management Views (Functions) ~1300 Extended Events 2100 Performance Monitor Counters Extensive SHOWPLAN statistics and warnings ERRORLOG, Event Log, System Health Session
  • 5.
    backup_restore_progress_trace event “database recoveryprogress” events dm_exec_input_buffer ALTER DATABASE SCOPED CONFIGRUATION list
  • 8.
  • 9.
    Feature RTM SP1 Standard WebExpress Standard Web Express Row-level security Yes No No Yes Yes Yes Dynamic Data Masking Yes No No Yes Yes Yes Change data capture* No No No Yes Yes No* Database snapshot No No No Yes Yes Yes Columnstore No No No Yes Yes Yes Partitioning No No No Yes Yes Yes Compression No No No Yes Yes Yes In Memory OLTP No No No Yes Yes Yes Always Encrypted No No No Yes Yes Yes PolyBase No No No Yes Yes Yes Fine grained auditing No No No Yes Yes Yes Multiple filestream containers No No No Yes Yes Yes * Requires SQL Server Agent which is not part of SQL Server Express Editions.
  • 10.
    SQL Server 2016SP1 Edition Max Buffer pool size per instance In-Memory OLTP quota (per DB) Express 1410MB 352MB Web 64GB 16GB Standard 128GB 32GB Developer Unlimited (OS Max of 24TB) Unlimited (OS Max of 24TB) Enterprise Unlimited (OS Max of 24 TB) Unlimited (OS Max of 24TB) SQL Server 2016 SP1 Edition Columnstore memory limit (per instance) MAXDOP Aggregate pushdown Filter pushdown SIMD support Express 256MB 1 N N N Web 16GB 1 N N N Standard 32GB 2 N N N Developer Unlimited (OS Max of 24TB) Unlimited Y Y Y Enterprise Unlimited (OS Max of 24TB) Unlimited Y Y Y In-Memory OLTP Columnstore
  • 11.
    Understanding the Memorylimits for non-EE editions of SQL Server Edition limits only impact buffer pool memory
  • 12.
    Advanced R integrationand Standalone R Server Polybase head node Master Data Services and Data Quality Services Resource Governor and IO Resource Governor Partition Table Parallelism Full NUMA capabilities Star join query optimizations Parallel query processing on partitioned tables and indexes Scalability and Performance in Enterprise Edition Global batch aggregation Distributed partitioned views Online index operations Auto use of indexed views Parallel CHECKDB Advanced scanning for disk-based tables
  • 13.
    I found thequery with the problem, now what do I do? I have “runaway” queries Why isn’t this seek working?
  • 15.
    Regular Query Profiling Full runtimestatistics for a query plan Most expensive overhead Can be enabled per session or global Consume data from live queries or post execution Lightweight Query Profiling Limited runtime statistics in query plan Least expensive overhead Only enabled globally only Consume data from live queries or post execution We optimized this even further in SQL Server 2016 SP1
  • 16.
    SET “option” output XEvent •query_post_execution_showplan • query_thread_profile DMVs • dm_exec_query_profiles • dm_exec_query_statistics_xml SSMS • Include Actual Plan • Include Live Statistics • Activity Monitor
  • 17.
    XEvent • query_thread_profile DMVs • dm_exec_query_profiles •dm_exec_query_statistics_xml SSMS • Activity Monitor • Include Live Statistics (through AM) • SET STATISTICS XML (or Include Actual Plan) still uses regular query profiling • query_post_execution_showplan still uses regular query profiling • query_thread_profile event is Debug Channel and does not include query plan
  • 18.
    Overhead percent (upto) Infra Type no active xEvents Active xEvent query_post_execution_showplan Regular (Legacy) 75.5 93.17 Lightweight in SQL Server 2014 SP2/2016 3.5 62.02 Lightweight in SQL Server 2016 SP1 2 14.3
  • 20.
    • Information aboutparameters data type • CPU and execution elapsed time for entire query (root node) • Top waits (using sys.dm_exec_session_wait_stats)
  • 21.
    • Per operatorperformance statistics for node and threads • Showplan extended to include RunTimeCountersPerThread • Node costs for parent and children: • Cumulative values for Row mode operators • Singleton values for Batch mode operators Detailed runtime stats we now provide Runtime Info Up to SQL 2016 SQL 2016 / SQL 2014 SP2 SQL 2016 SP1 ActualRows X X X ActualRowsRead X X Batches X X ActualEndOfScans X X X ActualExecutions X X X ActualExecutionMode X X ActualElapsedms X X ActualCPUms X X ActualScans X X ActualLogicalReads X X ActualPhysicalReads X X ActualReadAheads X X ActualLobLogicalReads X X ActualLobPhysicalReads X X ActualLobReadAheads X X InputMemoryGrant X OutputMemoryGrant X UsedMemoryGrant X
  • 25.
    Searching with pushdown SELECT[ProductID] FROM [Sales].[SalesOrderDetail] WHERE [ModifiedDate] BETWEEN '2011-01-01' AND '2012-01-01' AND [OrderQty] >= 10 ModifiedDate ProductID StoreID OrderQty SalesAmount 2010-12-31 106 01 12 30 2011-01-07 103 04 1 17 2011-01-07 109 04 7 20 2011-02-12 103 03 5 40 2011-03-08 106 05 7 25 2011-04-16 106 02 10 40 2011-07-20 102 02 12 50 2011-10-21 106 03 16 55 2011-12-15 103 03 20 55 (…) (…) (…) (…) (…) 2012-01-01 109 01 11 16 2012-01-11 102 05 5 10 Sales.SalesOrderDetail ModifiedDate ProductID StoreID OrderQty SalesAmount 2010-12-31 106 01 12 30 2011-01-07 103 04 1 17 2011-01-07 109 04 7 20 2011-02-12 103 03 5 40 2011-03-08 106 05 7 25 2011-04-16 106 02 10 40 2011-07-20 102 02 12 50 2011-10-21 106 03 16 55 2011-12-15 103 03 20 55 (…) (…) (…) (…) (…) 2012-01-01 109 01 11 16 2012-01-11 102 05 5 10 ModifiedDate ProductID StoreID OrderQty SalesAmount 2011-04-16 106 02 10 40 2011-07-20 102 02 12 50 2011-10-21 106 03 16 55 2011-12-15 103 03 20 55 (…) (…) (…) (…) (…) 2012-01-01 109 01 11 16 Result Set Actual Rows
  • 26.
    • In SQLServer 2016, 2014 SP2 and 2012 SP3 • New Showplan attribute ActualRowsRead: • This attribute provides information about how many rows were read by the operator before the residual predicate was applied. • You get this information from Actual Execution Plan. • sys.dm_exec_query_profiles DMV exposes new column actual_read_row_count. Predicate Pushdown in Showplan
  • 27.
    • In SQLServer 2016 SP1 • New Showplan attribute EstimatedRowsRead: • This attribute provides information about how many rows are estimated to be read by the operator before the residual predicate is applied. • You get this information from Estimated Execution Plan. • sys.dm_exec_query_profiles DMV exposes new column estimated_read_row_count. Predicate Pushdown in Showplan
  • 29.
    SELECT AddressID FROM Person.[Address] WHERECity = N'Ballard' AND [PostalCode] = '98107' OPTION (QUERYTRACEON 9481) SELECT AddressID FROM Person.[Address] WHERE City = N'Ballard' AND [PostalCode] = '98107' OPTION (USE HINT('FORCE_LEGACY_CARDINALITY_ESTIMATION'))
  • 30.
    USE HINT TFDB Option DISABLE_OPTIMIZED_NESTED_LOOP 2340 FORCE_LEGACY_CARDINALITY_ESTIMATION 9481 Yes ENABLE_QUERY_OPTIMIZER_HOTFIXES 4199 Yes DISABLE_PARAMETER_SNIFFING 4136 Yes ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES 4137 for OldCE 9471 for NewCE DISABLE_OPTIMIZER_ROWGOAL 4138 ENABLE_HIST_AMENDMENT_FOR_ASC_KEYS 4139 ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS 9476 on NewCE FORCE_DEFAULT_CARDINALITY_ESTIMATION 2312
  • 32.
    •KB 3190548CREATE ORALTER statement •KB 3191273 and 3191273Self-Referential Integrity operator •KB 3170114dm_db_incremental_stats_properties •3191296Track TLS protocol with trace xEvent
  • 36.
    Database Number ofObjects SSMS sp_clonedatabase DBCC CLONEDATABASE Large Bank DB 20453 Scripting error 378 seconds* 33 seconds (11x) Internal MS DB 80819 OOM 1200 seconds* 24 seconds (50x) ERP DB 1008002 OOM 7200 seconds* 122 seconds (60x) 3177838 Blog post on security Blog post on columnstore Not for production
  • 37.
    1 = ConventionalMemory Model 2 = Lock Pages in Memory 3 = Large Pages in Memory
  • 38.
  • 40.
  • 42.
  • 43.
  • 44.
    Query Store MemoryLeak AV for spatial query exec or XML plan Tempdb sysobjvalues latch increase In-Memory OLTP checkpoint files
  • 46.
    Adaptive QP Automatic Query PlanTuning Ensuring our Diagnostics on Linux are best in class New Query Store Reports in SSMS v17.0
  • 47.
    SQL Server TigerTeam Blog Tiger Toolbox GitHub SQL Server Release Blog BP Check SQL Server Standards Support Trace Flags SQL Server Support lifecycle SQL Server Updates Twitter

Editor's Notes

  • #7 Follow the readme.txt in demo1_2016_diagnostics
  • #13 Why do I need SQL Server Enterprise edition now with so many programming features in Standard edition? Enterprise edition continues to deliver the highest levels of mission critical scalability, availability, and performance, advanced business intelligence and analytics, as well as maximum virtualization with software assurance.  As an example, customers with mission critical enterprise applications and Enterprise Data Warehouses will need SQL Server Enterprise for Mission Critical high availability using Always On, to enable high-density database computing using maximum virtualization available with software assurance, and for maximum performance and scale above what is provided by Standard Edition (128GB all-up and 32GB for In-memory technologies) with up to 24TB of addressable memory and OS max processors when used with Windows Server 2016. In addition, SQL Server Enterprise supports much higher scale limits and grants special virtualization rights for volume license customers. Maximum Virtualization will continue to be a Software Assurance benefit that is only available to Enterprise Edition customers. More details are covered later in this FAQ.
  • #22 When you are troubleshooting query performance, metrics are never too much. With that in mind, based on customer feedback, but also our own CSS support, we have added runtime information to Showplan, and exposed a new Extended Event in SQL Server 2016. Regarding Showplan, take a test query on which we are doing a Clustered index Scan, and look the information available until SQL Server 2014: <RunTimeInformation> <RunTimeCountersPerThread Thread="0" ActualRows="8001" ActualEndOfScans="1" ActualExecutions="1" /> </RunTimeInformation> We can see the scan returned 8001 rows, but that doesn’t give you much insight regarding performance of the scan. But below we can observe what kind of detail we can get from runtime stats in SQL Server 2016 RC0. These include the actual rows read, I/O Reads, CPU time, and elapsed time, all exposed per-thread: <RunTimeInformation> <RunTimeCountersPerThread Thread="0" ActualRows="8001" ActualRowsRead="10000000" Batches="0" ActualEndOfScans="1" ActualExecutions="1" ActualExecutionMode="Row" ActualElapsedms="965" ActualCPUms="965" ActualScans="1" ActualLogicalReads="26073" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" InputMemoryGrant="115008" OutputMemoryGrant="4400" UsedMemoryGrant="2208“ /> </RunTimeInformation> We have also introduced a new Extended Event (query_thread_profile), allowing more insight on the performance of each node and thread: Note: Showplan time scale is shown in milliseconds, while the xEvent shows microseconds for CPU and total time.
  • #24 Follow the instructions in demo2__query_diagnostics
  • #29 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #30 © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • #31 Follow the instructions in readme.txt in demo3_pred_push
  • #34 Ex. For excessive mem grant, you can see how to improve estimations (perhaps update stats), or administratively by using MIN_PERCENT_GRANT and /or MAX_PERCENT_GRANT query hints.
  • #36 Follow the instructions in demo4_grant_warning