SlideShare a Scribd company logo
SQL SERVER FEATURES
THAT WILL BLOW YOUR MIND!
Ed Leighton-Dick
ABOUT ME
Email: ed@leightondick.com
Blog: edleightondick.com
Twitter: @eleightondick
AGENDA
• Window Functions
• Sparse Columns
• Filtered Indexes
• Snapshot Isolation
WINDOW FUNCTIONS
WINDOW FUNCTIONS
• First group introduced in SQL Server 2005
• Use OVER clause to create dynamic windows in the dataset
OVER()
• OVER(ORDER BY expressionList)
• OVER(PARTITION BY expressionList1 ORDER BY
expressionList2)
SQL Server Features That Will Blow Your Mind!
AGGREGATE FUNCTIONS
• COUNT, COUNT_BIG
• SUM
• AVG
• MAX
• MIN
• STDEV, STDEVP
• CHECKSUM_AGG
• VAR, VARP
RANKING FUNCTIONS
• ROW_NUMBER
• RANK
• DENSE_RANK
• NTILE
ANALYTIC FUNCTIONS
• LAG
• LEAD
• FIRST_VALUE
• LAST_VALUE
• CUME_DIST
• PERCENTILE_CONT
• PERCENTILE_DISC
• PERCENT_RANK
RANGE AND ROWS
• RANGE: Number of distinct values
• ROWS: Number of rows
• RANGE: Always uses disk-based worktable
• ROWS: Worktable in memory if less than 10K rows
SPARSE COLUMNS
SQL Server Features That Will Blow Your Mind!
FILTERED INDEXES
SQL Server Features That Will Blow Your Mind!
SNAPSHOT ISOLATION
WHY DO WE USE NOLOCK?
Image link: http://www.flixya.com/files-photo/k/e/v/kevinkr500-1881624.jpg
WHY DO WE USE NOLOCK?
• Removes blocking that exists in the default READ
COMMITTED isolation
THAT’S GOOD, RIGHT?
• Locks exist to prevent uncommitted data from being read
(“dirty reads”)
• Data sets can change during your query without locks
• “Halloween Problem”: Rows can move during query, showing
up in results twice
SQL Server Features That Will Blow Your Mind!
SNAPSHOT ISOLATION
• Introduced in SQL Server 2005
• Available in all editions
• More precisely referred to as “row versioning”
• Not related to database snapshots!
SQL Server Features That Will Blow Your Mind!
HOW IT WORKS
• Without snapshot isolation
HOW IT WORKS
• With snapshot isolation
tempdb
version store
HOW IT WORKS: RESOURCES
• 14-byte XSN added to each row
• Not added to existing rows until modified
• Row copied to version store in tempdb upon modification
• Row retained in version store until all transactions with lower
XSNs are finished
SNAPSHOT ISOLATION VS RCSI
• RCSI
• Implicit once turned on
• Affects each statement individually
• Snapshot isolation
• Explicit
• SET TRANSACTION ISOLATION LEVEL SNAPSHOT
• Affects entire transaction as a unit
REVIEW
• Window Functions
• Sparse Columns
• Filtered Indexes
• Snapshot Isolation
QUESTIONS?
Email: ed@leightondick.com
Blog: edleightondick.com
Twitter: @eleightondick
THANK YOU FOR ATTENDING!
~ Please remember to fill out your comment cards ~

More Related Content

PDF
Push jobs: an orchestration building block for private Chef
PPTX
SQL Server: Now It's Everywhere You Want to Be
PPTX
WEPA - Webdriver Enhanced Platform for Automation - WEPATest
PDF
(SPRING)KAFKA - ONE MORE ARSENAL IN A DISTRIBUTED TOOLBOX
PDF
SaltStack - An open source software story
PPTX
Ansible benelux meetup - Amsterdam 27-5-2015
PDF
Saluki - do it like a user
PPTX
Windows azurequickstart
Push jobs: an orchestration building block for private Chef
SQL Server: Now It's Everywhere You Want to Be
WEPA - Webdriver Enhanced Platform for Automation - WEPATest
(SPRING)KAFKA - ONE MORE ARSENAL IN A DISTRIBUTED TOOLBOX
SaltStack - An open source software story
Ansible benelux meetup - Amsterdam 27-5-2015
Saluki - do it like a user
Windows azurequickstart

What's hot (20)

PDF
0323社内LT大会
PPTX
WEB SERVER
PPTX
React. Flux. Redux
PPTX
Prezentacjasps office onlinesever_vaerpn
PPTX
Search and analyze your data with elasticsearch
PDF
New Server in an Hour #sqlsat121
KEY
2010.09.02 LT Doc fluxflex on JAWS-UG
PPTX
React. Flux. Redux. by Andrey Kolodnitskiy
PDF
Provisioning Rails Servers with Ansible
PPTX
News from Build 2013
PPTX
Top 10 PowerShell Features in Server 2012
PPTX
RavenDB 4.0
PDF
Training Slides: 101 - Basics: Tungsten Clustering - Under The Hood
PDF
Serverless On Stage - Serverless URL Shortener
PPTX
Marionette talk 2016
PDF
OpenNebulaConf2019 - 6 years (+) OpenNebula - Lessons learned - Sebastian Man...
PDF
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
PPTX
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
PPTX
Random thoughts on sql server performance
PDF
dodai_grizzly.pdf
0323社内LT大会
WEB SERVER
React. Flux. Redux
Prezentacjasps office onlinesever_vaerpn
Search and analyze your data with elasticsearch
New Server in an Hour #sqlsat121
2010.09.02 LT Doc fluxflex on JAWS-UG
React. Flux. Redux. by Andrey Kolodnitskiy
Provisioning Rails Servers with Ansible
News from Build 2013
Top 10 PowerShell Features in Server 2012
RavenDB 4.0
Training Slides: 101 - Basics: Tungsten Clustering - Under The Hood
Serverless On Stage - Serverless URL Shortener
Marionette talk 2016
OpenNebulaConf2019 - 6 years (+) OpenNebula - Lessons learned - Sebastian Man...
Devops and Immutable infrastructure - Cloud Expo 2015 NYC
OGDC Datastorage Solution_Mr.Dung, Dinh Nguyen Anh
Random thoughts on sql server performance
dodai_grizzly.pdf
Ad

Similar to SQL Server Features That Will Blow Your Mind! (20)

PDF
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (Chicago Suburb...
PDF
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (SQL Saturday M...
PDF
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (New England SQ...
PDF
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (PASSDC User Gr...
PDF
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (PASS DBA Virtu...
PDF
The Nightmare of Locking, Blocking and Isolation Levels!
PPTX
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
PDF
Concurrency in SQL Server (SQL Night #24)
PPT
SQL Server Transaction Management
PPTX
Key range locking
DOC
Sql server-dba
PPTX
Sql server concurrency
PPTX
Welcome to the nightmare of locking, blocking and isolation levels!
PPTX
Welcome to the nightmare of locking, blocking and isolation levels!
PDF
Report_on_Critique_Ansi_SQL_By_Raees
PPTX
SQL Server Select Topics
PPTX
The Nightmare of Locking, Blocking and Isolation Levels!
PPT
Ms sql server architecture
PDF
PDF
153680 sqlinterview
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (Chicago Suburb...
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (SQL Saturday M...
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (New England SQ...
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (PASSDC User Gr...
Locks, Blocks, and Snapshots: Maximizing Database Concurrency (PASS DBA Virtu...
The Nightmare of Locking, Blocking and Isolation Levels!
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Concurrency in SQL Server (SQL Night #24)
SQL Server Transaction Management
Key range locking
Sql server-dba
Sql server concurrency
Welcome to the nightmare of locking, blocking and isolation levels!
Welcome to the nightmare of locking, blocking and isolation levels!
Report_on_Critique_Ansi_SQL_By_Raees
SQL Server Select Topics
The Nightmare of Locking, Blocking and Isolation Levels!
Ms sql server architecture
153680 sqlinterview
Ad

More from Ed Leighton-Dick (9)

PPTX
How to Keep Your Databases Secure in Just Minutes a Day
PPTX
DevOps+Data: Working with Source Control
PPTX
Understanding SQL Server 2016 Always Encrypted
PPTX
Dammit Jim! Dr McCoy’s Field Guide to system_health (and the default trace)
PPTX
Protecting Your Data with Encryption
PPTX
Extending Your Availability Group for Disaster Recovery
PPTX
Get Involved!
PPTX
Service Broker: The Queue Continuum
PPTX
Practically Normal: An Introduction to Normalization
How to Keep Your Databases Secure in Just Minutes a Day
DevOps+Data: Working with Source Control
Understanding SQL Server 2016 Always Encrypted
Dammit Jim! Dr McCoy’s Field Guide to system_health (and the default trace)
Protecting Your Data with Encryption
Extending Your Availability Group for Disaster Recovery
Get Involved!
Service Broker: The Queue Continuum
Practically Normal: An Introduction to Normalization

Recently uploaded (20)

PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Mega Projects Data Mega Projects Data
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
Pilar Kemerdekaan dan Identi Bangsa.pptx
PPTX
modul_python (1).pptx for professional and student
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
(Ali Hamza) Roll No: (F24-BSCS-1103).pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
PDF
annual-report-2024-2025 original latest.
PDF
Introduction to Data Science and Data Analysis
PPTX
Modelling in Business Intelligence , information system
PDF
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
PPTX
Managing Community Partner Relationships
PDF
How to run a consulting project- client discovery
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PDF
Microsoft Core Cloud Services powerpoint
PDF
Business Analytics and business intelligence.pdf
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Mega Projects Data Mega Projects Data
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Pilar Kemerdekaan dan Identi Bangsa.pptx
modul_python (1).pptx for professional and student
climate analysis of Dhaka ,Banglades.pptx
(Ali Hamza) Roll No: (F24-BSCS-1103).pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
annual-report-2024-2025 original latest.
Introduction to Data Science and Data Analysis
Modelling in Business Intelligence , information system
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
Managing Community Partner Relationships
How to run a consulting project- client discovery
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Microsoft Core Cloud Services powerpoint
Business Analytics and business intelligence.pdf

SQL Server Features That Will Blow Your Mind!

Editor's Notes

  • #11: CUME_DIST (Cumulative Distribution), PERCENT_RANK – Relative position w/in group of values – Returns percentile/percent PERCENTILE_CONT – Percentile based on a continuous distribution of values – Returns interpolated value (may not exist) PERCENTILE_DISC – Percentile based on discrete distribution of values – Returns actual value