SlideShare a Scribd company logo
SQL Server. Expectation – Reality
Denis Reznik
Intapp
Email: denisreznik@gmail.com
Skype: denisreznik
Blog: http://reznik.uneta.com.ua
Twitter: @denisreznik
Agenda
• Some Useful Stuff to Remind
• Expectation - Reality 1
• Expectation - Reality 2
• Expectation - Reality 3
• Expectation - Reality 4
• Expectation - Reality 5
Index (B-Tree) - Seek
…
…
1 .. 1M
1 .. 2K 2K+1 .. 4K
1M-2K .. 1M
1 .. 300 301..800 801..1,5K 1,5K+1..2K
SELECT * FROM Users
WHERE Id = 523
Index (B-Tree) - Scan
…
…
1 .. 1M
1 .. 2K 2K+1 .. 4K
1M-2K .. 1M
1 .. 300 301..800 801..1,5K 1,5K+1..2K
SELECT * FROM Users
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 1 AND 5300
Exec SomeProc @p
Optimizer
Buffer Pool
Query Plan
cache
@p
Plan is cached for the
first value of Query Plan
cache
Parameter Sniffing – Intro
Lock Types - Shared
S S
X
Lock Types - Exclusive
X
X
S
Lock Types - Update
U
U
S
SX
READ COMMITTED
ID City
1 Kiev
2 London
3 London
4 London
5 London
6 New York
7 New York
ID City
1 London
2 London
3 London
4 London
5 London
6 New York
7 New York
SELECT * FROM Users
WHERE City = 'Kiev'
BEGIN TRAN
UPDATE Users
SET City = 'London'
WHERE City = 'Kiev' SELECT * FROM Users
WHERE City = 'Kiev'
Wait for
Shared lock on
the row
X S
READ COMMITTED SNAPSHOT
ID City
1 Kiev
2 London
3 London
4 London
5 London
6 New York
7 New York
ID City
1 London
2 London
3 London
4 London
5 London
6 New York
7 New York
BEGIN TRAN
UPDATE Users
SET City = 'London'
WHERE City = 'Kiev'
SELECT * FROM Users
WHERE City = 'Kiev'
SELECT * FROM Users
WHERE City = 'Kiev'
X
tempdb
ID City
1 Kiev
Version Store
READ UNCOMMITTED
ID City
1 Kiev
2 London
3 London
4 London
5 London
6 New York
7 New York
ID City
1 London
2 London
3 London
4 London
5 London
6 New York
7 New York
SELECT * FROM Users
WHERE City = 'Kiev'
BEGIN TRAN
UPDATE Users
SET City = 'London'
WHERE City = 'Kiev' SELECT * FROM Users
WHERE City = 'Kiev'
0 RecordsROLLBACK
SELECT * FROM Users
WHERE City = 'Kiev'
X
DEMO: Universal Query
DEMO: Conditional Logic
DEMO: Implicit Locks
DEMO: NOLOCK Locks
DEMO: The Most Confusing
Behavior
Summary
• Universal Query
• Conditional Logic
• Implicit Locks
• NOLOCK Locks
• The Most Confusing Behavior
Thank You!
@denisreznik
denisreznik@gmail.com
http://reznik.uneta.com.ua/
https://www.facebook.com/denis.reznik.5
https://www.linkedin.com/pub/denis-reznik/3/502/234

More Related Content

What's hot (13)

PDF
C++ Windows Forms L06 - Utlitity and Strings
Mohammad Shaker
 
PDF
DOM-based Test Adequacy Criteria for Web Applications
SALT Lab @ UBC
 
PDF
C++ Windows Forms L02 - Controls P1
Mohammad Shaker
 
PPTX
Delete the branches from remote repositories(GIT)
Prudhvi Raj Dodda
 
PDF
C++ Windows Forms L03 - Controls P2
Mohammad Shaker
 
PDF
C++ Windows Forms L04 - Controls P3
Mohammad Shaker
 
PDF
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
PPT
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Nikos Mpalatsoukas
 
PDF
Calculator code
Rajeev Sharan
 
PPTX
Lesson 207 19 oct13-1500-ay
Codecademy Ren
 
PDF
Inventory management
Rajeev Sharan
 
PDF
Gutenberg 4.0
Sören Wrede
 
PDF
Slink into Elixir
LINE Corporation
 
C++ Windows Forms L06 - Utlitity and Strings
Mohammad Shaker
 
DOM-based Test Adequacy Criteria for Web Applications
SALT Lab @ UBC
 
C++ Windows Forms L02 - Controls P1
Mohammad Shaker
 
Delete the branches from remote repositories(GIT)
Prudhvi Raj Dodda
 
C++ Windows Forms L03 - Controls P2
Mohammad Shaker
 
C++ Windows Forms L04 - Controls P3
Mohammad Shaker
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
Χρήση Vba για την πρόσβαση σε βάση δεδομένων
Nikos Mpalatsoukas
 
Calculator code
Rajeev Sharan
 
Lesson 207 19 oct13-1500-ay
Codecademy Ren
 
Inventory management
Rajeev Sharan
 
Gutenberg 4.0
Sören Wrede
 
Slink into Elixir
LINE Corporation
 

Viewers also liked (20)

PDF
Андрей Шумада | Tank.ly
Fwdays
 
PDF
Fighting Fat Models (Богдан Гусев)
Fwdays
 
PDF
"Frameworks in 2015" Андрей Листочкин
Fwdays
 
PPTX
"Красная книга веб-разработчика" Виктор Полищук
Fwdays
 
PDF
Евгений Жарков AngularJS: Good parts
Fwdays
 
PDF
Илья Прукко: "Как дизайнеру не становиться художником"
Fwdays
 
PDF
Алексей Рыбаков: "Wearable OS год спустя: Apple Watch 2.0, Android Wear 5.1.1...
Fwdays
 
PDF
Lightweight APIs in mRuby (Михаил Бортник)
Fwdays
 
PPTX
Трансформация команды: от инди разработки к играм с коммерческой успешностью
Fwdays
 
PDF
Евгений Обрезков "Behind the terminal"
Fwdays
 
PPT
"Spring Boot. Boot up your development" Сергей Моренец
Fwdays
 
PDF
Светлана Старикова "Building a self-managing team: why you should not have e...
Fwdays
 
PDF
Анастасия Войтова: "Building profanity filters on mobile: clbuttic sh!t"
Fwdays
 
PDF
Michael North "The Road to Native Web Components"
Fwdays
 
PDF
Александр Воронов | Building CLI with Swift
Fwdays
 
PDF
4 puchnina.pptx
Fwdays
 
PDF
Анатолий Попель: "Формы оплаты и платёжные шлюзы"
Fwdays
 
PPTX
Швейцарія, масштабування Scrum і розподілені команди от Романа Сахарова
Fwdays
 
PDF
Сергей Яковлев "Phalcon 2 - стабилизация и производительность"
Fwdays
 
PDF
Designing for Privacy
exultantwarning51
 
Андрей Шумада | Tank.ly
Fwdays
 
Fighting Fat Models (Богдан Гусев)
Fwdays
 
"Frameworks in 2015" Андрей Листочкин
Fwdays
 
"Красная книга веб-разработчика" Виктор Полищук
Fwdays
 
Евгений Жарков AngularJS: Good parts
Fwdays
 
Илья Прукко: "Как дизайнеру не становиться художником"
Fwdays
 
Алексей Рыбаков: "Wearable OS год спустя: Apple Watch 2.0, Android Wear 5.1.1...
Fwdays
 
Lightweight APIs in mRuby (Михаил Бортник)
Fwdays
 
Трансформация команды: от инди разработки к играм с коммерческой успешностью
Fwdays
 
Евгений Обрезков "Behind the terminal"
Fwdays
 
"Spring Boot. Boot up your development" Сергей Моренец
Fwdays
 
Светлана Старикова "Building a self-managing team: why you should not have e...
Fwdays
 
Анастасия Войтова: "Building profanity filters on mobile: clbuttic sh!t"
Fwdays
 
Michael North "The Road to Native Web Components"
Fwdays
 
Александр Воронов | Building CLI with Swift
Fwdays
 
4 puchnina.pptx
Fwdays
 
Анатолий Попель: "Формы оплаты и платёжные шлюзы"
Fwdays
 
Швейцарія, масштабування Scrum і розподілені команди от Романа Сахарова
Fwdays
 
Сергей Яковлев "Phalcon 2 - стабилизация и производительность"
Fwdays
 
Designing for Privacy
exultantwarning51
 
Ad

Similar to "Query Execution: Expectation - Reality (Level 300)" Денис Резник (20)

PPTX
SQL Server Deep Drive
DataArt
 
PPTX
.NET Fest 2017. Денис Резник. Исполнение Запроса в SQL Server. Ожидание - Реа...
NETFest
 
PPTX
Se2017 query-optimizer
Mary Prokhorova
 
PPTX
SQL Server Deep Dive, Denis Reznik
Sigma Software
 
PPTX
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Fwdays
 
PPTX
Big Data-Driven Applications with Cassandra and Spark
Artem Chebotko
 
PPTX
.NET Fest 2018. Денис Резник. Почему мой запрос тормозит и как это исправить
NETFest
 
PDF
"What database can tell about application issues? What application can tell a...
Fwdays
 
PPTX
Index the obvious and not so obvious
Harry Zheng
 
PPTX
Understanding Performance with DTrace
ahl0003
 
PPTX
SqlSaturday199 - Deadlocks
Денис Резник
 
PPTX
.NET Fest 2019. Денис Резник. Когда SQL Server Best Practices не работают
NETFest
 
PDF
Moving Toward Deep Learning Algorithms on HPCC Systems
HPCC Systems
 
PPT
ZFConf 2011: Что такое Sphinx, зачем он вообще нужен и как его использовать с...
ZFConf Conference
 
PPTX
How nebula graph index works
Nebula Graph
 
KEY
10x improvement-mysql-100419105218-phpapp02
promethius
 
KEY
10x Performance Improvements
Ronald Bradford
 
PPTX
Denis Reznik "Оптимизация запроса. Не знаешь что делать? Делай то, что знаешь"
Fwdays
 
PDF
Kicking ass with redis
Dvir Volk
 
PPTX
Hotsos 2012
Connor McDonald
 
SQL Server Deep Drive
DataArt
 
.NET Fest 2017. Денис Резник. Исполнение Запроса в SQL Server. Ожидание - Реа...
NETFest
 
Se2017 query-optimizer
Mary Prokhorova
 
SQL Server Deep Dive, Denis Reznik
Sigma Software
 
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Fwdays
 
Big Data-Driven Applications with Cassandra and Spark
Artem Chebotko
 
.NET Fest 2018. Денис Резник. Почему мой запрос тормозит и как это исправить
NETFest
 
"What database can tell about application issues? What application can tell a...
Fwdays
 
Index the obvious and not so obvious
Harry Zheng
 
Understanding Performance with DTrace
ahl0003
 
SqlSaturday199 - Deadlocks
Денис Резник
 
.NET Fest 2019. Денис Резник. Когда SQL Server Best Practices не работают
NETFest
 
Moving Toward Deep Learning Algorithms on HPCC Systems
HPCC Systems
 
ZFConf 2011: Что такое Sphinx, зачем он вообще нужен и как его использовать с...
ZFConf Conference
 
How nebula graph index works
Nebula Graph
 
10x improvement-mysql-100419105218-phpapp02
promethius
 
10x Performance Improvements
Ronald Bradford
 
Denis Reznik "Оптимизация запроса. Не знаешь что делать? Делай то, что знаешь"
Fwdays
 
Kicking ass with redis
Dvir Volk
 
Hotsos 2012
Connor McDonald
 
Ad

More from Fwdays (20)

PDF
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
Fwdays
 
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
PPTX
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
Fwdays
 
PPTX
"Як ми переписали Сільпо на Angular", Євген Русаков
Fwdays
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
"Validation and Observability of AI Agents", Oleksandr Denisyuk
Fwdays
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
Fwdays
 
PPTX
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
Fwdays
 
PDF
"AI is already here. What will happen to your team (and your role) tomorrow?"...
Fwdays
 
PPTX
"Is it worth investing in AI in 2025?", Alexander Sharko
Fwdays
 
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
PDF
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
PDF
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
PDF
"Scaling in space and time with Temporal", Andriy Lupa .pdf
Fwdays
 
PPTX
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
Fwdays
 
PPTX
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
Fwdays
 
PPTX
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
PPTX
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...
Fwdays
 
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
Fwdays
 
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
Fwdays
 
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
Fwdays
 
"Як ми переписали Сільпо на Angular", Євген Русаков
Fwdays
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
"Validation and Observability of AI Agents", Oleksandr Denisyuk
Fwdays
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
Fwdays
 
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
Fwdays
 
"AI is already here. What will happen to your team (and your role) tomorrow?"...
Fwdays
 
"Is it worth investing in AI in 2025?", Alexander Sharko
Fwdays
 
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
"Scaling in space and time with Temporal", Andriy Lupa .pdf
Fwdays
 
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
Fwdays
 
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
Fwdays
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...
Fwdays
 

Recently uploaded (20)

PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
July Patch Tuesday
Ivanti
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 

"Query Execution: Expectation - Reality (Level 300)" Денис Резник