SlideShare a Scribd company logo
TOP 10
DEVELOPER
MISTAKES
THAT WON’T
SCALEBRENT OZAR, MCM
BRENT OZAR PLF
BRENTOZAR.COM/GO/SC
ALE
POSSIBLE
OR
PROBABLE
TODAY’S AGENDA
Triggers
SELECT *
UDFs
Dynamic SQL
Big Fields
Heaps
Binaries
Old Indexes
TempDB
V1 Features
10. TRIGGERS
Automated business logic
Always enforced
Instantaneous
Transparent to application
Reduces network traffic
WHY TRIGGERS DON’T
SCALE
Can’t uncouple timing
Can’t uncouple processing
Minimal error handling
Messy multi-record handling
TYPICAL TRIGGER
DESIGN
CREATE TRIGGER trig_addUser ON Users
FOR INSERT AS
DECLARE @newStatus VARCHAR(10)
SELECT @newStatus = (SELECT StatusName FROM
Inserted)
IF @newStatus = 'INACTIVE'
PRINT 'Inactive employees not allowed.’
ROLLBACK
TRIGGER ALTERNATIVES
SQL Agent Job
Application Server
Service Broker
9. SELECT *
SELECT TOP 100 *
FROM dbo.Posts
WHERE OwnerUserId = 1538
SELECT TOP 100 Tags, Id
FROM dbo.Posts
WHERE OwnerUserID = 1538
Temp tables: old and busted
Table variables: the new hotness
8. TABLE VARIABLES
Table variables are in memory
Don’t hit TempDB
Not logged
Must be faster
MID-CAREER-CRISIS DBA
SAYS
Picture Source http://www.flickr.com/photos/bounder/1233004463/
DECLARE @Cruisers TABLE (ID INT IDENTITY(1,1), CruiserName
VARCHAR(100));
INSERT INTO @Cruisers VALUES ('Tim Ford');
SELECT * FROM @Cruisers;
THE TABLE VARIABLE
STATS PROBLEM
DECLARE @Cruisers TABLE (ID INT IDENTITY(1,1), CruiserName
VARCHAR(100));
INSERT INTO @Cruisers VALUES ('Tim Ford');
INSERT INTO @Cruisers VALUES ('Brent Ozar');
SELECT * FROM @Cruisers;
NOW WITH TWO ROWS…
DECLARE @Cruisers TABLE (ID INT IDENTITY(1,1), CruiserName
VARCHAR(100));
INSERT INTO @Cruisers VALUES ('Tim Ford');
INSERT INTO @Cruisers VALUES ('Brent Ozar');
SELECT * FROM @Cruisers OPTION RECOMPILE;
USING OPTION
RECOMPILE
“Let’s use
OPTION RECOMPILE everywhere.”
MID-CAREER-CRISIS DBA
SAYS
Picture Source http://www.flickr.com/photos/bounder/1233004463/
7. DYNAMIC SQL
DECLARE @string NVARCHAR(100)
SELECT @string = 'select * from authors'
+ 'ORDER BY ' + @OrderBy
EXEC sp_executesql @string
DYNAMIC SQL
ALTERNATIVES
Move it into the app
Build permanent stored procedures
Educate your developers with:
6. BIG FIELDS
Bit
Tinyint
Smallint
Int
Varchar
NVarchar
PROBLEMS WITH
BIG FIELDS
More memory means less is cached
More storage means slower IO
More sort space required
Study of effects:
http://BrentOzar.com/go/bigfields
5. BINARIES
IN THE DATABASE
SharePoint
Document management
Fax software
Web site images
File uploads
ALTERNATIVE STORAGE
SQL Server 2008’s FileStream
SQL Server 2008 R2’s Remote Blob Storage
SQL Server Denali’s FileTable
Store pointers, not files
Content Distribution Networks (CDNs)
4. HEAPS
WHEN HEAPS AREN’T
BAD
Staging tables
Temporary or one-time backups
When you’ve really, really tested them
HOW TO FIND HEAPS:
BRENTOZAR.COM/GO/HE
APS
HOW TO FIX ‘EM
Implement a primary key
Ask the developers & business for unique fields
Sometimes PK != CL
In a rush? Use identity fields
Measure for improvement
3. IGNORING INDEXES
HOW TO SCALE
Pick a business statistic
Set a baseline
Monitor growth
Revisit indexes
Reset baseline
Remove
Indexes
Add
Indexes
Observe
REMOVING INDEXES
ADDING MISSING
INDEXES
THE RESULTS
2. RELYING ON TEMPDB
CONSIDER AN
APP-BASED TEMPDB
One per app, like AccountingTempDB
Can tweak storage
Avoids differential backup problems
Avoids log shipping, mirroring problems
1. USING VERSION 1.0
FEATURES
Photo Source http://www.flickr.com/photos/nobihaya/96169325/
PAST ONE-AND-DONE
FEATURES
SQL Server Notification Services
English Query
SQLMail
DTS Packages (well, 2 versions)
Surface Area Configuration Tool
Vardecimal
SQL 2008 V1.0
Master Data Services
StreamInsight
PowerPivot
FileStream
Remote Blob Storage
Performance Data Warehouse
Change Data Capture
Change Tracking
Resource Governor
DAC Pack
Photo Source http://www.flickr.com/photos/seantyler/2632084397/
EARLY ADOPTERS
Expect bugs, not scalability
Meet peers, share work
Expect fast rework
Photo Source http://www.flickr.com/photos/denn/18743985/
RECAP
You’re no Einstein
Set yourself up for success
Gotta scale? Avoid v1.0.
Learn more:
BrentOzar.com/go/scale
Photo Source http://www.flickr.com/photos/jonkeegan/28036718/

More Related Content

Similar to Top 10 Developer Mistakes That Won't Scale with SQL Server

Data stage Online Training
Data stage Online TrainingData stage Online Training
Data stage Online Training
Glory IT Technologies Pvt. Ltd.
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons Learned
João Pedro Martins
 
"Running CF in a Shared Hosting Environment"
"Running CF in a Shared Hosting Environment""Running CF in a Shared Hosting Environment"
"Running CF in a Shared Hosting Environment"
webhostingguy
 
Serverless Computing
Serverless ComputingServerless Computing
Serverless Computing
Anand Gupta
 
Boosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsBoosting the Performance of your Rails Apps
Boosting the Performance of your Rails Apps
Matt Kuklinski
 
Performance Tuning of the Transaction Log
Performance Tuning of the Transaction LogPerformance Tuning of the Transaction Log
Performance Tuning of the Transaction Log
Miroslav Dimitrov
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
João Pedro Martins
 
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Bolke de Bruin
 
Lotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes ClientLotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes Client
panagenda
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
Philip Norton
 
ConFoo 2017: Introduction to performance optimization of .NET web apps
ConFoo 2017: Introduction to performance optimization of .NET web appsConFoo 2017: Introduction to performance optimization of .NET web apps
ConFoo 2017: Introduction to performance optimization of .NET web apps
Pierre-Luc Maheu
 
IBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClassIBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClass
Paul Withers
 
Best Practices and Lessons Learned on Our IBM Rational Insight Deployment
Best Practices and Lessons Learned on Our IBM Rational Insight DeploymentBest Practices and Lessons Learned on Our IBM Rational Insight Deployment
Best Practices and Lessons Learned on Our IBM Rational Insight Deployment
Marc Nehme
 
Quick & Easy SQL Tips
Quick & Easy SQL TipsQuick & Easy SQL Tips
Quick & Easy SQL Tips
Ike Ellis
 
Quick & Easy SQL Tips
Quick & Easy SQL TipsQuick & Easy SQL Tips
Quick & Easy SQL Tips
Ike Ellis
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
sqlserver.co.il
 
Db As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
Db As Behaving Badly... Worst Practices For Database Administrators Rod ColledgeDb As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
Db As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
sqlserver.co.il
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
Serhat Dirik
 
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaSAtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
Atlassian
 
Best Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and DeltaBest Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and Delta
Databricks
 

Similar to Top 10 Developer Mistakes That Won't Scale with SQL Server (20)

Data stage Online Training
Data stage Online TrainingData stage Online Training
Data stage Online Training
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons Learned
 
"Running CF in a Shared Hosting Environment"
"Running CF in a Shared Hosting Environment""Running CF in a Shared Hosting Environment"
"Running CF in a Shared Hosting Environment"
 
Serverless Computing
Serverless ComputingServerless Computing
Serverless Computing
 
Boosting the Performance of your Rails Apps
Boosting the Performance of your Rails AppsBoosting the Performance of your Rails Apps
Boosting the Performance of your Rails Apps
 
Performance Tuning of the Transaction Log
Performance Tuning of the Transaction LogPerformance Tuning of the Transaction Log
Performance Tuning of the Transaction Log
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
 
Lotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes ClientLotusphere 2012: BP110 Performance Boost for your Notes Client
Lotusphere 2012: BP110 Performance Boost for your Notes Client
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
ConFoo 2017: Introduction to performance optimization of .NET web apps
ConFoo 2017: Introduction to performance optimization of .NET web appsConFoo 2017: Introduction to performance optimization of .NET web apps
ConFoo 2017: Introduction to performance optimization of .NET web apps
 
IBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClassIBM Think Session 8598 Domino and JavaScript Development MasterClass
IBM Think Session 8598 Domino and JavaScript Development MasterClass
 
Best Practices and Lessons Learned on Our IBM Rational Insight Deployment
Best Practices and Lessons Learned on Our IBM Rational Insight DeploymentBest Practices and Lessons Learned on Our IBM Rational Insight Deployment
Best Practices and Lessons Learned on Our IBM Rational Insight Deployment
 
Quick & Easy SQL Tips
Quick & Easy SQL TipsQuick & Easy SQL Tips
Quick & Easy SQL Tips
 
Quick & Easy SQL Tips
Quick & Easy SQL TipsQuick & Easy SQL Tips
Quick & Easy SQL Tips
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
Db As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
Db As Behaving Badly... Worst Practices For Database Administrators Rod ColledgeDb As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
Db As Behaving Badly... Worst Practices For Database Administrators Rod Colledge
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
 
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaSAtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
AtlasCamp 2015: Damn you Facebook - Raising the bar in SaaS
 
Best Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and DeltaBest Practices for Building Robust Data Platform with Apache Spark and Delta
Best Practices for Building Robust Data Platform with Apache Spark and Delta
 

More from Brent Ozar

Fundamentals of TempDB
Fundamentals of TempDBFundamentals of TempDB
Fundamentals of TempDB
Brent Ozar
 
Fundamentals of Columnstore - Introductions
Fundamentals of Columnstore - IntroductionsFundamentals of Columnstore - Introductions
Fundamentals of Columnstore - Introductions
Brent Ozar
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix It
Brent Ozar
 
Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!
Brent Ozar
 
An Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent OzarAn Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent Ozar
Brent Ozar
 
How to Think Like the SQL Server Engine
How to Think Like the SQL Server EngineHow to Think Like the SQL Server Engine
How to Think Like the SQL Server Engine
Brent Ozar
 
SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?
Brent Ozar
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Brent Ozar
 
Headaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and DeadlockingHeadaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and Deadlocking
Brent Ozar
 
"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems
Brent Ozar
 
Columnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil AgarwalColumnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil Agarwal
Brent Ozar
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
Brent Ozar
 
Introduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the EngineIntroduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the Engine
Brent Ozar
 
Building a Fast, Reliable SQL Server for kCura Relativity
Building a Fast, Reliable SQL Server for kCura RelativityBuilding a Fast, Reliable SQL Server for kCura Relativity
Building a Fast, Reliable SQL Server for kCura Relativity
Brent Ozar
 
How to Make SQL Server Go Faster
How to Make SQL Server Go FasterHow to Make SQL Server Go Faster
How to Make SQL Server Go Faster
Brent Ozar
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
Brent Ozar
 
What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015
Brent Ozar
 

More from Brent Ozar (17)

Fundamentals of TempDB
Fundamentals of TempDBFundamentals of TempDB
Fundamentals of TempDB
 
Fundamentals of Columnstore - Introductions
Fundamentals of Columnstore - IntroductionsFundamentals of Columnstore - Introductions
Fundamentals of Columnstore - Introductions
 
Deadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix ItDeadlocks: Lets Do One, Understand It, and Fix It
Deadlocks: Lets Do One, Understand It, and Fix It
 
Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!Help! SQL Server 2008 is Still Here!
Help! SQL Server 2008 is Still Here!
 
An Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent OzarAn Introduction to GitHub for DBAs - Brent Ozar
An Introduction to GitHub for DBAs - Brent Ozar
 
How to Think Like the SQL Server Engine
How to Think Like the SQL Server EngineHow to Think Like the SQL Server Engine
How to Think Like the SQL Server Engine
 
SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?SQL Query Optimization: Why Is It So Hard to Get Right?
SQL Query Optimization: Why Is It So Hard to Get Right?
 
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored ProceduresDynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
Dynamic SQL: How to Build Fast Multi-Parameter Stored Procedures
 
Headaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and DeadlockingHeadaches of Blocking, Locking, and Deadlocking
Headaches of Blocking, Locking, and Deadlocking
 
"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems"But It Worked In Development!" - 3 Hard SQL Server Problems
"But It Worked In Development!" - 3 Hard SQL Server Problems
 
Columnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil AgarwalColumnstore Customer Stories 2016 by Sunil Agarwal
Columnstore Customer Stories 2016 by Sunil Agarwal
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
 
Introduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the EngineIntroduction to SQL Server Internals: How to Think Like the Engine
Introduction to SQL Server Internals: How to Think Like the Engine
 
Building a Fast, Reliable SQL Server for kCura Relativity
Building a Fast, Reliable SQL Server for kCura RelativityBuilding a Fast, Reliable SQL Server for kCura Relativity
Building a Fast, Reliable SQL Server for kCura Relativity
 
How to Make SQL Server Go Faster
How to Make SQL Server Go FasterHow to Make SQL Server Go Faster
How to Make SQL Server Go Faster
 
500-Level Guide to Career Internals
500-Level Guide to Career Internals500-Level Guide to Career Internals
500-Level Guide to Career Internals
 
What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015What I Learned About SQL Server at Ignite 2015
What I Learned About SQL Server at Ignite 2015
 

Recently uploaded

Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 

Recently uploaded (20)

Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 

Top 10 Developer Mistakes That Won't Scale with SQL Server

Editor's Notes

  1. Uncouple timing – if we’re under heavy load and we just need to get the records in, we can’t. Processing – the crunching always has to happen on the SQL Server Minimal error handling – if something goes wrong, it can be difficult to gracefully alert humans Messy multi-record handling – people don’t build triggers right. Say we build a system that used to allow inactive employees, and now we want to add a trigger to not allow any new ones to be inserted.
  2. This doesn’t mean triggers are wrong. This just means BAD implementations of triggers are wrong. And there’s a lot of ways to go wrong with triggers. Let’s talk alternatives.
  3. In SSMS, you can do two queries, and it’ll show you the relative cost of the query. 98% of the crunch time went to the top query. Why? The bottom one can use an index. SQL Server doesn’t know that you don’t really need every single field on the table. Copies that data across the network, uses more memory in cache, uses more memory in your application too. All the hard work you put into indexing – gone. Fix: just don’t do it. Specify the fields you need. When you see it in someone’s slow query, try replacing it with just the fields you need. Then you can do effective index tuning. SQL Server’s DMVs will recommend bad indexes if you’re using SELECT *.
  4. The sad truth is that all of these are wrong, and in fact, table variables are usually SLOWER.
  5. This problem gets worse and worse with bigger volumes of data. Even with just 100 rows, SQL Server will make a spectacularly bad decisions about when it should do lookups versus table scans on OTHER tables.
  6. Gives us statement-level recompilations. SQL Server stops and does a gut check with everything it’s learned so far. This is great inside stored procs, because everything else in the stored proc keeps its execution plan.
  7. The sad truth is that all of these are wrong, and in fact, table variables are usually SLOWER.
  8. Better solution: stick with temp tables.
  9. Bobby Tables SQL Injection Problems with execution plan caching
  10. Customer table with Customer status field, Active bit. “We’re only going to need active/inactive, so let’s use a bit.” “Well, we might need more statuses in the future. Let’s use a tinyint.” “Well, what if we want to use a child table later to store statuses? We use Int for our primary keys.” Same approach happens with varchar – “Active” or “Inactive”. What if we get acquired by an international company and we need unicode in there? Gets worse with bigger fields - Social Security Numbers, addresses, customer numbers
  11. If you use a varchar field to store status, your application has to be able to handle invalid values. If you store Customer Number in five places in the DB, and they’re all smallint except one is a bigint, guess what’s gonna break? App, views, sps, temp tables, table variables What if somebody goofs up an update and misspells “Active”? What if there’s data corruption? More IO – Micelle Ufford has an excellent study at SQLPass I’ll link to in the show notes where storage is cut by 1/3 when fields are sized appropriately. Smaller indexes, smaller backups, faster defrags. Alternative – right-size your fields and document them.
  12. Heap is a table with no clustered index. No logical order to how the data is stored on disk. SQL Server just throws it wherever.
  13. Gives you exact index creation scripts Examine top two rows – same table, same equality column, different includes If we just build the top one, we’ll satisfy both requirements Need to combine the results of these together, analyze them, AND factor in your current indexes
  14. Temporary, and shared. Can run into TempDB contention problems when you’re constantly creating and destroying objects Usually not indexed well – people just create objects and think I just need ‘em once and they’ll be small But it’s a shared environment and you’re fighting for others with resources Not just other USERS, but database processes too. Sorts, indexing, snapshot isolation modes Totally unpredictable performance Solution – persist objects in their own databases. Either in the original DB, or make a user DB for it.
  15. Sometimes things take off right away, and they become massively popular. Sometimes…
  16. Sometimes they don’t You think it won’t be a problem for you?