SlideShare a Scribd company logo
1 of 13
Tweet Tweet – What Developers
Need to Know About SQL Server
Brent Ozar
SQL Server DBA, Microsoft MVP
Microsoft Certified Master of SQL Server
Intro
I recently hosted a Twitter Chat on everything developers would need to know
about designing databases. I was joined by Richard Douglas, a SQL server for
Dell Software and also the Editor in Chief of SQLServerpedia.com.
We asked our followers and participants to share their tips and best practices
using the hashtag: #dellsql. The following slideshow content is what we
deemed as most useful to our audience. Enjoy!

2

Room for text

Global Marketing
@SQLintheWild says “Get it Right the First Time”
• Understand the changing database
design from the beginning

Remember
• As your app grows and more stuff
interfaces with it, simply refactoring
the database is no longer an option

3

Room for text

Global Marketing
@alzdba says “Use the Right Data Types”
• Tell the database when a field is
unique and relates to a field in
another table
• Set up constraints or foreign key
relationships

Remember
• This can actually make your queries
faster because SQL Server uses this
knowledge to build better execution
plans

4

Room for text

Global Marketing
@MarkStacey says “Use DATE if You Don’t Need Time”
• DATE is a narrower field
than DATETIME, requiring
less storage.

Remember
• You can pack more rows
per page on your date
indexes

5

Room for text

Global Marketing
@RealSQLGuy says “NVACHAR is Not an All-Purpose
Datatype”
• Use the bare minimum and size data
needs

Remember
• NVARCHAR is Unicode, which uses
2x the storage space for as
compared to just plain VARCHAR.
• This means you can cache half as
many rows in memory, plus your
storage IO takes twice as long

6

Room for text

Global Marketing
@SirSQL says “Blobs Rarely Belong in the Database”
• Varbinary (max) should be an
anomaly

Remember
• Licensing databases is way
more expensive than
licensing a file server

7

Room for text

Global Marketing
@Ruirrib says “Not all Types are Good for Primary Keys”
• Primary keys & clustering keys
should be:
– Narrow
– Static
– Ever-increasing

Remember
• Don’t go redesigning an existing
database to change this,
because it’s probably not your
biggest bottleneck

8

Room for text

Global Marketing
@dpenton says “If Your First Inclination is to use a Trigger,
Stop”
• Believe it or not, you could be
viewing the problem wrong

• Consider moving to an asynchronous
solution

9

Room for text

Global Marketing
@RealSQLGuy says “There’s No Need for an Index on
Every Column in the Table”
• Narrow, one-field indexes are usually
less useful

Remember
• If you insert a record into a table with
10 non-clustered indexes, you’ll be
doing 11 (or more) writes to disk each
time. Why bother if you could save
time with one-field indexes?

10

Room for text

Global Marketing
@Nick Craver says “Don’t Run SSMS Index Suggestions
Blindly”
• SQL SMS’s index suggestions have
no concerns about adding overhead
to inserts/updates/deletes
Remember
• More often than not, they’re
supersets or subsets of existing
indexes

11

Room for text

Global Marketing
@SQLintheWild says “Know the Common Queries that Run
Against Indexes for Table Structures”
• Word to the wise: don’t go crazy
adding indexes with guesses when
you first get started with a new
database
Remember
• Indexes are easy to add later – wait to
see how the queries actually shape
up

12

Room for text

Global Marketing
For More Information
• To view the twitter chat, go to: http://bit.ly/HVh4m3
• To learn more about Solutions for SQL Server: http://dell.to/1cxeM7Q

13

Room for text

Global Marketing

More Related Content

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Tweet Tweet – What Developers Need to Know about SQL Server

  • 1. Tweet Tweet – What Developers Need to Know About SQL Server Brent Ozar SQL Server DBA, Microsoft MVP Microsoft Certified Master of SQL Server
  • 2. Intro I recently hosted a Twitter Chat on everything developers would need to know about designing databases. I was joined by Richard Douglas, a SQL server for Dell Software and also the Editor in Chief of SQLServerpedia.com. We asked our followers and participants to share their tips and best practices using the hashtag: #dellsql. The following slideshow content is what we deemed as most useful to our audience. Enjoy! 2 Room for text Global Marketing
  • 3. @SQLintheWild says “Get it Right the First Time” • Understand the changing database design from the beginning Remember • As your app grows and more stuff interfaces with it, simply refactoring the database is no longer an option 3 Room for text Global Marketing
  • 4. @alzdba says “Use the Right Data Types” • Tell the database when a field is unique and relates to a field in another table • Set up constraints or foreign key relationships Remember • This can actually make your queries faster because SQL Server uses this knowledge to build better execution plans 4 Room for text Global Marketing
  • 5. @MarkStacey says “Use DATE if You Don’t Need Time” • DATE is a narrower field than DATETIME, requiring less storage. Remember • You can pack more rows per page on your date indexes 5 Room for text Global Marketing
  • 6. @RealSQLGuy says “NVACHAR is Not an All-Purpose Datatype” • Use the bare minimum and size data needs Remember • NVARCHAR is Unicode, which uses 2x the storage space for as compared to just plain VARCHAR. • This means you can cache half as many rows in memory, plus your storage IO takes twice as long 6 Room for text Global Marketing
  • 7. @SirSQL says “Blobs Rarely Belong in the Database” • Varbinary (max) should be an anomaly Remember • Licensing databases is way more expensive than licensing a file server 7 Room for text Global Marketing
  • 8. @Ruirrib says “Not all Types are Good for Primary Keys” • Primary keys & clustering keys should be: – Narrow – Static – Ever-increasing Remember • Don’t go redesigning an existing database to change this, because it’s probably not your biggest bottleneck 8 Room for text Global Marketing
  • 9. @dpenton says “If Your First Inclination is to use a Trigger, Stop” • Believe it or not, you could be viewing the problem wrong • Consider moving to an asynchronous solution 9 Room for text Global Marketing
  • 10. @RealSQLGuy says “There’s No Need for an Index on Every Column in the Table” • Narrow, one-field indexes are usually less useful Remember • If you insert a record into a table with 10 non-clustered indexes, you’ll be doing 11 (or more) writes to disk each time. Why bother if you could save time with one-field indexes? 10 Room for text Global Marketing
  • 11. @Nick Craver says “Don’t Run SSMS Index Suggestions Blindly” • SQL SMS’s index suggestions have no concerns about adding overhead to inserts/updates/deletes Remember • More often than not, they’re supersets or subsets of existing indexes 11 Room for text Global Marketing
  • 12. @SQLintheWild says “Know the Common Queries that Run Against Indexes for Table Structures” • Word to the wise: don’t go crazy adding indexes with guesses when you first get started with a new database Remember • Indexes are easy to add later – wait to see how the queries actually shape up 12 Room for text Global Marketing
  • 13. For More Information • To view the twitter chat, go to: http://bit.ly/HVh4m3 • To learn more about Solutions for SQL Server: http://dell.to/1cxeM7Q 13 Room for text Global Marketing