SlideShare a Scribd company logo
SQL
START!
2023
SQL Server 2022
Programmability & Performance
Gianluca Hotz
ghotz@ugiss.org | @glhotz
Sponsors & Organizers
Who am I?
• Gianluca Hotz | @glhotz | ghotz@ugiss.org
• Independent Consultant
• 25+ years on SQL Server (from 4.21 back in 1996)
• Database modeling & development, sizing & administration, modernization
(upgrades & migrations), performance tuning, security
• Community
• 24 years Microsoft MVP SQL Server/Data Platform (from 1998)
• VMware Experts SQL Server
• Founder and president UGISS (ex «PASS Chapter»)
Agenda
• Programmability
• Performance
Programmability
SQL Server 2022 Programmability & Performance
T-SQL
• GREATEST
• LEAST
• STRING_SPLIT
• TRIM functions
• DATETRUNC
• IS [NOT] DISTINCT FROM
• WINDOW clause
• LEFT_SHIFT
• RIGHT_SHIFT
• BIT_COUNT
• GET_BIT
• SET_BIT
JSON
• ISJSON
• JSON_PATH_EXISTS
• JSON_OBJECT
• JSON_ARRAY
Time Series
• DATE_BUCKET
• GENERATE_SERIES
• FIRST_VALUE
• LAST_VALUE
Programmability enhancements
XML Compression
• Finally!!! 
• New CREATE/ALTER TABLE or CREATE/ALTER INDEX option
• XML_COMPRESSION = ON|OFF [ON PARTITIONS(…)]
• More info
• https://learn.microsoft.com/sql/t-sql/statements/create-index-transact-
sql#xml_compression
Multi-write replication
• Last Writer Wins (LWW) in Peer-to-peer transactional replication
• Introduced in SQL Server 2019 CU13
• Previously manual resolution in case of conflict and replication paused
• Enterprise Edition only
• More info
• https://learn.microsoft.com/sql/relational-
databases/replication/transactional/peer-to-peer-conflict-detection-in-peer-
to-peer-replication#automatically-handle-conflicts-with-last-write-wins
• https://techcommunity.microsoft.com/t5/sql-server-blog/replication-
enhancements-in-the-sql-server-2019-cu13-release/ba-p/2814727
Always Encrypted with Secure Enclaves
• Enhancements inside enclave
• Multiple threads and key caching
• More operations supported
• More info
• https://learn.microsoft.com/sql/relationa
l-databases/security/encryption/always-
encrypted-enclaves
Operation/
Support
Azure SQL
Database
SQL Server
2022
SQL Server
2019
Comparison
operators
Yes Yes Yes
BETWEEN Yes Yes Yes
IN Yes Yes Yes
LIKE Yes Yes Yes
DISTINCT Yes Yes Yes
Joins Yes Yes Only nested
loops
ORDER BY Yes Yes No
GROUP BY Yes Yes No
Append-Only
Ledger Table
Trusted
Storage
Database Ledger
Block N Block N-1 Block N-2
Updatable
Ledger Table
History Table
Ledger View
Ledger Tables
• Updatable allow insert/update/delete
• History of updated/deleted rows preserved in
history table and easy-to-query Ledger View
• Integrity of updatable/history tables maintained
through cryptographic links of the Database
Ledger
• System can periodically upload digital receipts to
a customer-configured trusted storage service
• Customer can use digital receipts to verify the
integrity of the data
• Append-Only allow only insert
• no need for a history table
HTTPS REST API
SQL Engine
wasb
abs
abfs
adls
Performance
SQL Server 2022 Programmability & Performance
Buffer Pool parallel scans
• BP operations use hash tables (BUF structures to find pages)
• Some operations still needs to scan all BUF structures
• Problem on systems with large amount of memory e.g. 1TB+
• SQL Server warning in ERRORLOG
• https://docs.microsoft.com/troubleshoot/sql/performance/buffer-pool-scan-runs-
slowly-large-memory-machines
• SQL Server 2022 introduces buffer pool parallel scan
• Enabled by default (available in Standard and Enterprise editions)
• Standard Edition limited to 2 threads on 64GB
• More info
• https://cloudblogs.microsoft.com/sqlserver/2022/07/07/improve-scalability-with-
buffer-pool-parallel-scan-in-sql-server-2022
• https://youtu.be/4GvU106Xiag
“Hands-free” tempdb
Pre
SQL
Server
2019
1 file = PFS, GAM,
SGAM contention
Add multiple files
Trace flags 1117
and 1118
SQL 2016 setup auto
adds multiple files
Trace flags not
required by SQL
Server 2016
SQL
Server
2022
SGAM and GAM
concurrency
Latch contention gone
SQL
Server
2019
PFS concurrency
Autogrow and
uniform default
for tempdb
Now system table
pages become
hotspot
Tempdb metadata
optimization ON
SGAM and GAM
contention remain
“Purvi’s list”
• Reduced buffer pool I/O promotions
• Tuned read-ahead to avoid single page promotions to 8 pages I/Os
• Enhanced spinlock algorithms
• No details, internal adjustments make spinlocks more efficient…
• Improved Virtual Log File (VLF) algorithms
• If growth > 1/8 current size, if < 64MB creates 1 VLF instead of 4
• https://learn.microsoft.comsql/relational-databases/sql-server-transaction-
log-architecture-and-management-guide#virtual-log-files-vlfs
• Instant file initialization (IFI) for transaction log file growth events!!!
• Only growth events up to 64MB!
Columnstore enhancements
• Ordered Clustered Columnstore Index!
• https://docs.microsoft.com/azure/synapse-analytics/sql-data-
warehouse/performance-tuning-ordered-cci
• Columnstore string enhancements
• Deep data (e.g. char, binary, guid) min/max maintained when rebuilding
• Fast string-equal operation
• LIKE pushdown (RG elimination only for prefix searches i.e. str% not %str)
• Segment elimination
• Extends to string, binary, guid data types and datetimeoffset w/ scale > 2
• Was only numeric, date, time data types and datetimeoffset w/ scale <= 2
Batch mode enhancements
• Processor Advanced Vector Extension (AVX) 512
• Some operations faster for Columnstore and Rowstore batch mode
• Recommended for the following processors
• Intel Ice Lake and later
• AMD EYPC Genoa and later
• Currently enabled by trace flag 15097
• https://learn.microsoft.com/sql/t-sql/database-console-commands/dbcc-
traceon-trace-flags-transact-sql#tf15097
Hybrid Buffer Pool
• SQL Server 2019
• Clean pages directly referenced on PMEM devices without copy
• Dirty pages still kept in DRAM
• SQL Server 2022
• Direct write, reduces number of memcpy operations
• Currently enabled by trace flag 809
• https://learn.microsoft.com/sql/t-sql/database-console-commands/dbcc-traceon-trace-
flags-transact-sql#tf809
• More info
• https://learn.microsoft.com/sql/database-engine/configure-windows/hybrid-
buffer-pool#hybrid-buffer-pool-with-direct-write
Query Store enhancements
• On by default (migrated databases retain original configuration)
• Query Store Hints (shape plans with no code changes)
• Query Store support for AG secondary replicas
• Now used also by Intelligent Query Processing
Query Store hints
• Process much simpler than Plan Guides
• Find query id in Query Store
• Use sys.sp_query_store_set_hints to apply hint
• Check for hint failures in sys.query_store_query_hints
• Hints survive plan cache eviction and restart!
• More info
• https://learn.microsoft.com/sql/relational-databases/performance/query-
store-hints
Query Store hints support
• Supported hints
• { HASH | ORDER } GROUP
• { CONCAT | HASH | MERGE } UNION
• { LOOP | MERGE | HASH } JOIN
• EXPAND VIEWS
• FAST number_rows
• FORCE ORDER
• IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX
• KEEP PLAN
• KEEPFIXED PLAN
• MAX_GRANT_PERCENT = percent
• MIN_GRANT_PERCENT = percent
• MAXDOP number_of_processors
• NO_PERFORMANCE_SPOOL
• OPTIMIZE FOR UNKNOWN
• PARAMETERIZATION { SIMPLE | FORCED }
• RECOMPILE
• ROBUST PLAN
• USE HINT ( '<hint_name>' [ , ...n ] )
• Unsupported hints
• OPTIMIZE FOR(@var = val)
• MAXRECURSION
• USE PLAN
• consider QP original plan forcing
• DISABLE_DEFERRED_COMPILATION_TV
• DISABLE_TSQL_SCALAR_UDF_INLINING
• Table hints
• E.g. FORCESEEK, READUNCOMMITTED, INDEX
• Feature interoperability
• https://learn.microsoft.com/sql/relational-
databases/performance/query-store-hints#query-
store-hints-and-feature-interoperability
Query Store for AG secondary replicas
• Primary replica stores data
• For all replicas
• Column replica_group_id only in
• sys.query_store_replicas
• sys.query_store_runtime_stats
• sys.query_store_wait_stats
• Enabled by trace flag 12606
• More info
• https://learn.microsoft.com/sql/relationa
l-databases/performance/query-store-
for-secondary-replicas
Query Store and IQP
Query Store
Degree of Parallelism
(DOP) feedback
Parameter Sensitive Plan
(PSP) Optimization
Cardinality Estimation
(CE) feedback
Intelligent Query Processing (IQP)
Next Generation
Feedback store
Hints
Intelligent Query Processing Gen 3
Intelligent QP
Adaptive QP
Adaptive Joins
Batch Mode
Interleaved
Execution
Query
Processing
Feedback
Memory Grant
Feedback
Row Mode Batch Mode
Percentile
Grant
Feedback
CE Feedback DOP Feedback
Feedback
Persistence
Parameter
Sensitive Plan
Optimization
Optimized
Plan Forcing
Approximate
QP
Approximate
Count Distinct
Approximate
Percentile
Table Variable
Deferred
Compilation
Batch Mode
on Row Store
Scalar UDF
Inlining
SQL Server 2017+
SQL Server 2019+
SQL Server 2022+
Enterprise Edition
IPQ changes not gated by dbcompat…
SQL Server
2022
• Approximate Percentile
• PERCENTILE_CONT
• PERCENTILE_DISC
• Optimized Plan Forcing
• Persists compile steps
• Reduce compilation
overhead
dbcompat
140+
• Memory Grant
Percentiles
• Smooth oscillation
• Memory Grant Feedback
Persistence
• Survive cache eviction
and restart
dbcompat 160
• Parameter Sensitive Plan
(PSP) Optimization
• Cardinality Estimation
(CE) Feedback
• Degree of Parallelism
(DOP) feedback
Hardware offloaded backup compression
• Currently only Intel QuickAssist (QAT) supported
• Install drivers
• Diagnostic DMV sys.dm_server_accelerator_status
• Enable functionality
• sp_configure 'hardware offload enabled’
• Enable specific accelerator
• ALTER SERVER CONFIGURATION SET
HARDWARE_OFFLOAD = ON|OFF (ACCELERATOR = QAT[, MODE = SOFTWARE])
• Backup
• COMPRESSION ALGORITHM = MS_XPRESS|other_algorithm
• Usually, good performance with concurrent intensive workload
• More info
• https://docs.microsoft.com/sql/relational-databases/system-tables/backupset-
transact-sql
Learn more about SQL Server 2022
aka.ms/sqlserver2022
Download SQL Server 2022
aka.ms/getsqlserver2022
Get our decks
aka.ms/sqlserver2022decks
What’s new for SQL Server 2022
aka.ms/sqlserver2022docs
Try our demos
aka.ms/sqlserver2022demos
Watch Microsoft Mechanics
aka.ms/sqlserver2022mechanics
Don’t miss us on Data Exposed
aka.ms/dataexposed
Read the SQL Server 2022 Blog Series
aka.ms/sqlserver2022blogs
Take the Microsoft Learning Path
aka.ms/learnsqlserver2022
Read the book
aka.ms/sql2022book
Try out the workshop
aka.ms/sql2022workshop

More Related Content

Similar to SQL Server 2022 Programmability & Performance (20)

PDF
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
PPTX
Novidades do SQL Server 2016
Marcos Freccia
 
PPTX
SQL Server 2016 New Features and Enhancements
John Martin
 
PDF
SQL Server 2014 for Developers (Cristian Lefter)
ITCamp
 
PPTX
The roadmap for sql server 2019
Javier Villegas
 
PPTX
Expert summit SQL Server 2016
Łukasz Grala
 
PPTX
SQL Server 2014 – Features Drilldown.pptx
QuyVo27
 
PPTX
SQL server 2016 New Features
Amin Mesbahi
 
PPTX
SQL Server 2016 new features
SpanishPASSVC
 
PPTX
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
PDF
SQL Server database engine 2017 enhancements
Gianluca Hotz
 
PPTX
SQL Server 2014 Features
Karunakar Kotha
 
PPTX
Novedades SQL Server 2014
netmind
 
PPTX
SQL Server Workshop for Developers - Visual Studio Live! NY 2012
Andrew Brust
 
PDF
Sql server 2016 new features
Ajeet Singh
 
PDF
Sql server 2016 new features
Ajeet pratap Singh
 
PPTX
SQL Server It Just Runs Faster
Bob Ward
 
DOCX
Sql server 2008 r2 programmability datasheet
Klaudiia Jacome
 
PPTX
05_DP_300T00A_Optimize.pptx
KareemBullard1
 
PPTX
SQL Server2012 Enhancements
Abhishek Sur
 
Modernizing your database with SQL Server 2019
Antonios Chatzipavlis
 
Novidades do SQL Server 2016
Marcos Freccia
 
SQL Server 2016 New Features and Enhancements
John Martin
 
SQL Server 2014 for Developers (Cristian Lefter)
ITCamp
 
The roadmap for sql server 2019
Javier Villegas
 
Expert summit SQL Server 2016
Łukasz Grala
 
SQL Server 2014 – Features Drilldown.pptx
QuyVo27
 
SQL server 2016 New Features
Amin Mesbahi
 
SQL Server 2016 new features
SpanishPASSVC
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
SQL Server database engine 2017 enhancements
Gianluca Hotz
 
SQL Server 2014 Features
Karunakar Kotha
 
Novedades SQL Server 2014
netmind
 
SQL Server Workshop for Developers - Visual Studio Live! NY 2012
Andrew Brust
 
Sql server 2016 new features
Ajeet Singh
 
Sql server 2016 new features
Ajeet pratap Singh
 
SQL Server It Just Runs Faster
Bob Ward
 
Sql server 2008 r2 programmability datasheet
Klaudiia Jacome
 
05_DP_300T00A_Optimize.pptx
KareemBullard1
 
SQL Server2012 Enhancements
Abhishek Sur
 

More from Gianluca Hotz (20)

PPTX
Multitenancy con SQL Server e Azure SQL Database
Gianluca Hotz
 
PPTX
Microsoft SQL Server PaaS (Platform as a Service)
Gianluca Hotz
 
PDF
SQL Server 2022 Intelligent Query Processing
Gianluca Hotz
 
PDF
IaaS and PaaS relational databases in the cloud
Gianluca Hotz
 
PDF
Data Integrity with SQL Database Ledger
Gianluca Hotz
 
PDF
Azure SQL Database Ledger
Gianluca Hotz
 
PDF
Come utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Gianluca Hotz
 
PDF
Best Practices for Running Microsoft SQL Server on AWS
Gianluca Hotz
 
PDF
SQL Server in AWS
Gianluca Hotz
 
PDF
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Gianluca Hotz
 
PDF
Azure SQL Database Ledger
Gianluca Hotz
 
PDF
SQL Server Modern Query Processing
Gianluca Hotz
 
PDF
SQL Server in AWS
Gianluca Hotz
 
PDF
SQL Server Failover Cluster Instances con Azure Managed Disks
Gianluca Hotz
 
PDF
SQL Server Back to Basics: Sicurezza
Gianluca Hotz
 
PDF
SQL Server Failover Cluster Instances con Amazon FSx in AWS
Gianluca Hotz
 
PDF
SQL Server Data Virtualization with polybase
Gianluca Hotz
 
PDF
SQL Server Data Virtualization with Polybase
Gianluca Hotz
 
PDF
SQL Server Modern Query Processing
Gianluca Hotz
 
PDF
SQL Server Modernization
Gianluca Hotz
 
Multitenancy con SQL Server e Azure SQL Database
Gianluca Hotz
 
Microsoft SQL Server PaaS (Platform as a Service)
Gianluca Hotz
 
SQL Server 2022 Intelligent Query Processing
Gianluca Hotz
 
IaaS and PaaS relational databases in the cloud
Gianluca Hotz
 
Data Integrity with SQL Database Ledger
Gianluca Hotz
 
Azure SQL Database Ledger
Gianluca Hotz
 
Come utilizzare AWS DMS per migrare SQL Server ad Amazon Aurora
Gianluca Hotz
 
Best Practices for Running Microsoft SQL Server on AWS
Gianluca Hotz
 
SQL Server in AWS
Gianluca Hotz
 
Come utilizzare AWS Database Migration Service per migrare SQL Server ad Amaz...
Gianluca Hotz
 
Azure SQL Database Ledger
Gianluca Hotz
 
SQL Server Modern Query Processing
Gianluca Hotz
 
SQL Server in AWS
Gianluca Hotz
 
SQL Server Failover Cluster Instances con Azure Managed Disks
Gianluca Hotz
 
SQL Server Back to Basics: Sicurezza
Gianluca Hotz
 
SQL Server Failover Cluster Instances con Amazon FSx in AWS
Gianluca Hotz
 
SQL Server Data Virtualization with polybase
Gianluca Hotz
 
SQL Server Data Virtualization with Polybase
Gianluca Hotz
 
SQL Server Modern Query Processing
Gianluca Hotz
 
SQL Server Modernization
Gianluca Hotz
 
Ad

Recently uploaded (20)

PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
July Patch Tuesday
Ivanti
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Ad

SQL Server 2022 Programmability & Performance

  • 3. Who am I? • Gianluca Hotz | @glhotz | [email protected] • Independent Consultant • 25+ years on SQL Server (from 4.21 back in 1996) • Database modeling & development, sizing & administration, modernization (upgrades & migrations), performance tuning, security • Community • 24 years Microsoft MVP SQL Server/Data Platform (from 1998) • VMware Experts SQL Server • Founder and president UGISS (ex «PASS Chapter»)
  • 5. Programmability SQL Server 2022 Programmability & Performance
  • 6. T-SQL • GREATEST • LEAST • STRING_SPLIT • TRIM functions • DATETRUNC • IS [NOT] DISTINCT FROM • WINDOW clause • LEFT_SHIFT • RIGHT_SHIFT • BIT_COUNT • GET_BIT • SET_BIT JSON • ISJSON • JSON_PATH_EXISTS • JSON_OBJECT • JSON_ARRAY Time Series • DATE_BUCKET • GENERATE_SERIES • FIRST_VALUE • LAST_VALUE Programmability enhancements
  • 7. XML Compression • Finally!!!  • New CREATE/ALTER TABLE or CREATE/ALTER INDEX option • XML_COMPRESSION = ON|OFF [ON PARTITIONS(…)] • More info • https://learn.microsoft.com/sql/t-sql/statements/create-index-transact- sql#xml_compression
  • 8. Multi-write replication • Last Writer Wins (LWW) in Peer-to-peer transactional replication • Introduced in SQL Server 2019 CU13 • Previously manual resolution in case of conflict and replication paused • Enterprise Edition only • More info • https://learn.microsoft.com/sql/relational- databases/replication/transactional/peer-to-peer-conflict-detection-in-peer- to-peer-replication#automatically-handle-conflicts-with-last-write-wins • https://techcommunity.microsoft.com/t5/sql-server-blog/replication- enhancements-in-the-sql-server-2019-cu13-release/ba-p/2814727
  • 9. Always Encrypted with Secure Enclaves • Enhancements inside enclave • Multiple threads and key caching • More operations supported • More info • https://learn.microsoft.com/sql/relationa l-databases/security/encryption/always- encrypted-enclaves Operation/ Support Azure SQL Database SQL Server 2022 SQL Server 2019 Comparison operators Yes Yes Yes BETWEEN Yes Yes Yes IN Yes Yes Yes LIKE Yes Yes Yes DISTINCT Yes Yes Yes Joins Yes Yes Only nested loops ORDER BY Yes Yes No GROUP BY Yes Yes No
  • 10. Append-Only Ledger Table Trusted Storage Database Ledger Block N Block N-1 Block N-2 Updatable Ledger Table History Table Ledger View Ledger Tables • Updatable allow insert/update/delete • History of updated/deleted rows preserved in history table and easy-to-query Ledger View • Integrity of updatable/history tables maintained through cryptographic links of the Database Ledger • System can periodically upload digital receipts to a customer-configured trusted storage service • Customer can use digital receipts to verify the integrity of the data • Append-Only allow only insert • no need for a history table
  • 11. HTTPS REST API SQL Engine wasb abs abfs adls
  • 12. Performance SQL Server 2022 Programmability & Performance
  • 13. Buffer Pool parallel scans • BP operations use hash tables (BUF structures to find pages) • Some operations still needs to scan all BUF structures • Problem on systems with large amount of memory e.g. 1TB+ • SQL Server warning in ERRORLOG • https://docs.microsoft.com/troubleshoot/sql/performance/buffer-pool-scan-runs- slowly-large-memory-machines • SQL Server 2022 introduces buffer pool parallel scan • Enabled by default (available in Standard and Enterprise editions) • Standard Edition limited to 2 threads on 64GB • More info • https://cloudblogs.microsoft.com/sqlserver/2022/07/07/improve-scalability-with- buffer-pool-parallel-scan-in-sql-server-2022 • https://youtu.be/4GvU106Xiag
  • 14. “Hands-free” tempdb Pre SQL Server 2019 1 file = PFS, GAM, SGAM contention Add multiple files Trace flags 1117 and 1118 SQL 2016 setup auto adds multiple files Trace flags not required by SQL Server 2016 SQL Server 2022 SGAM and GAM concurrency Latch contention gone SQL Server 2019 PFS concurrency Autogrow and uniform default for tempdb Now system table pages become hotspot Tempdb metadata optimization ON SGAM and GAM contention remain
  • 15. “Purvi’s list” • Reduced buffer pool I/O promotions • Tuned read-ahead to avoid single page promotions to 8 pages I/Os • Enhanced spinlock algorithms • No details, internal adjustments make spinlocks more efficient… • Improved Virtual Log File (VLF) algorithms • If growth > 1/8 current size, if < 64MB creates 1 VLF instead of 4 • https://learn.microsoft.comsql/relational-databases/sql-server-transaction- log-architecture-and-management-guide#virtual-log-files-vlfs • Instant file initialization (IFI) for transaction log file growth events!!! • Only growth events up to 64MB!
  • 16. Columnstore enhancements • Ordered Clustered Columnstore Index! • https://docs.microsoft.com/azure/synapse-analytics/sql-data- warehouse/performance-tuning-ordered-cci • Columnstore string enhancements • Deep data (e.g. char, binary, guid) min/max maintained when rebuilding • Fast string-equal operation • LIKE pushdown (RG elimination only for prefix searches i.e. str% not %str) • Segment elimination • Extends to string, binary, guid data types and datetimeoffset w/ scale > 2 • Was only numeric, date, time data types and datetimeoffset w/ scale <= 2
  • 17. Batch mode enhancements • Processor Advanced Vector Extension (AVX) 512 • Some operations faster for Columnstore and Rowstore batch mode • Recommended for the following processors • Intel Ice Lake and later • AMD EYPC Genoa and later • Currently enabled by trace flag 15097 • https://learn.microsoft.com/sql/t-sql/database-console-commands/dbcc- traceon-trace-flags-transact-sql#tf15097
  • 18. Hybrid Buffer Pool • SQL Server 2019 • Clean pages directly referenced on PMEM devices without copy • Dirty pages still kept in DRAM • SQL Server 2022 • Direct write, reduces number of memcpy operations • Currently enabled by trace flag 809 • https://learn.microsoft.com/sql/t-sql/database-console-commands/dbcc-traceon-trace- flags-transact-sql#tf809 • More info • https://learn.microsoft.com/sql/database-engine/configure-windows/hybrid- buffer-pool#hybrid-buffer-pool-with-direct-write
  • 19. Query Store enhancements • On by default (migrated databases retain original configuration) • Query Store Hints (shape plans with no code changes) • Query Store support for AG secondary replicas • Now used also by Intelligent Query Processing
  • 20. Query Store hints • Process much simpler than Plan Guides • Find query id in Query Store • Use sys.sp_query_store_set_hints to apply hint • Check for hint failures in sys.query_store_query_hints • Hints survive plan cache eviction and restart! • More info • https://learn.microsoft.com/sql/relational-databases/performance/query- store-hints
  • 21. Query Store hints support • Supported hints • { HASH | ORDER } GROUP • { CONCAT | HASH | MERGE } UNION • { LOOP | MERGE | HASH } JOIN • EXPAND VIEWS • FAST number_rows • FORCE ORDER • IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX • KEEP PLAN • KEEPFIXED PLAN • MAX_GRANT_PERCENT = percent • MIN_GRANT_PERCENT = percent • MAXDOP number_of_processors • NO_PERFORMANCE_SPOOL • OPTIMIZE FOR UNKNOWN • PARAMETERIZATION { SIMPLE | FORCED } • RECOMPILE • ROBUST PLAN • USE HINT ( '<hint_name>' [ , ...n ] ) • Unsupported hints • OPTIMIZE FOR(@var = val) • MAXRECURSION • USE PLAN • consider QP original plan forcing • DISABLE_DEFERRED_COMPILATION_TV • DISABLE_TSQL_SCALAR_UDF_INLINING • Table hints • E.g. FORCESEEK, READUNCOMMITTED, INDEX • Feature interoperability • https://learn.microsoft.com/sql/relational- databases/performance/query-store-hints#query- store-hints-and-feature-interoperability
  • 22. Query Store for AG secondary replicas • Primary replica stores data • For all replicas • Column replica_group_id only in • sys.query_store_replicas • sys.query_store_runtime_stats • sys.query_store_wait_stats • Enabled by trace flag 12606 • More info • https://learn.microsoft.com/sql/relationa l-databases/performance/query-store- for-secondary-replicas
  • 23. Query Store and IQP Query Store Degree of Parallelism (DOP) feedback Parameter Sensitive Plan (PSP) Optimization Cardinality Estimation (CE) feedback Intelligent Query Processing (IQP) Next Generation Feedback store Hints
  • 24. Intelligent Query Processing Gen 3 Intelligent QP Adaptive QP Adaptive Joins Batch Mode Interleaved Execution Query Processing Feedback Memory Grant Feedback Row Mode Batch Mode Percentile Grant Feedback CE Feedback DOP Feedback Feedback Persistence Parameter Sensitive Plan Optimization Optimized Plan Forcing Approximate QP Approximate Count Distinct Approximate Percentile Table Variable Deferred Compilation Batch Mode on Row Store Scalar UDF Inlining SQL Server 2017+ SQL Server 2019+ SQL Server 2022+ Enterprise Edition
  • 25. IPQ changes not gated by dbcompat… SQL Server 2022 • Approximate Percentile • PERCENTILE_CONT • PERCENTILE_DISC • Optimized Plan Forcing • Persists compile steps • Reduce compilation overhead dbcompat 140+ • Memory Grant Percentiles • Smooth oscillation • Memory Grant Feedback Persistence • Survive cache eviction and restart dbcompat 160 • Parameter Sensitive Plan (PSP) Optimization • Cardinality Estimation (CE) Feedback • Degree of Parallelism (DOP) feedback
  • 26. Hardware offloaded backup compression • Currently only Intel QuickAssist (QAT) supported • Install drivers • Diagnostic DMV sys.dm_server_accelerator_status • Enable functionality • sp_configure 'hardware offload enabled’ • Enable specific accelerator • ALTER SERVER CONFIGURATION SET HARDWARE_OFFLOAD = ON|OFF (ACCELERATOR = QAT[, MODE = SOFTWARE]) • Backup • COMPRESSION ALGORITHM = MS_XPRESS|other_algorithm • Usually, good performance with concurrent intensive workload • More info • https://docs.microsoft.com/sql/relational-databases/system-tables/backupset- transact-sql
  • 27. Learn more about SQL Server 2022 aka.ms/sqlserver2022 Download SQL Server 2022 aka.ms/getsqlserver2022 Get our decks aka.ms/sqlserver2022decks What’s new for SQL Server 2022 aka.ms/sqlserver2022docs Try our demos aka.ms/sqlserver2022demos Watch Microsoft Mechanics aka.ms/sqlserver2022mechanics Don’t miss us on Data Exposed aka.ms/dataexposed Read the SQL Server 2022 Blog Series aka.ms/sqlserver2022blogs Take the Microsoft Learning Path aka.ms/learnsqlserver2022 Read the book aka.ms/sql2022book Try out the workshop aka.ms/sql2022workshop

Editor's Notes

  • #7: https://techcommunity.microsoft.com/t5/azure-sql-blog/announcing-json-enhancements-in-azure-sql-database-azure-sql/ba-p/3417071