SlideShare una empresa de Scribd logo
1 de 27
SQL 2008 Performance Improvements
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object]
Some notes… ,[object Object],[object Object],[object Object],[object Object]
Table Partitioning Background ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
File Types
Filegroups ,[object Object]
Partitioning ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Partitioning ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Partitioning Filegroup test1fg test2fg test3fg test4fg Partition Num. 1 2 3 4 Values col1  <= 1 col1  > 1 AND  col1  <= 100 col1  > 100 AND  col1  <= 1000 col1  > 1000
Partitioning ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multiple Threads per Partition
Multiple Threads per Partition Utilises machines with large number of processors, each thread will run on separate CPU.
Partition Level Lock Escalation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Partition Aware Seek operation ,[object Object],[object Object],[object Object]
Partition Information  Enhancements ,[object Object],[object Object],[object Object],[object Object]
Sparse Columns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sparse Columns – Decision Table Data type Nonsparse bytes Sparse bytes NULL percentage bit 0.125 4.125 98% tinyint 1 5 86% smallint 2 6 76% int 4 8 64% bigint 8 12 52% real 4 8 64% float 8 12 52% smallmoney 4 8 64% money 8 12 52% smalldatetime 4 8 64% datetime 8 12 52% uniqueidentifier 16 20 43% date 3 7 69%
Sparse Columns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sparse Columns ,[object Object],[object Object],[object Object],[object Object],[object Object]
Filtered Indexes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Filtered Indexes CREATE  NONCLUSTERED  INDEX INDEX_1   ON  Production.BillOfMaterials (ComponentID, StartDate)      WHERE EndDate IS NOT NULL  ;
Filtered Indexes ,[object Object],[object Object],[object Object],[object Object]
Plan Freezing ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sample Existing SP: SELECT TOP 1 * FROM Sales.SalesOrderHeader ORDER BY OrderDate DESC;
Sample Override plan: sp_create_plan_guide  @name = N'Guide2',  @stmt = N'SELECT TOP 1 * FROM Sales.SalesOrderHeader ORDER BY OrderDate DESC',  @type = N'SQL',  @module_or_batch = NULL,  @params = NULL,  @hints = N'OPTION (MAXDOP 1)';
MERGE Statement Outperforms equivalent multiple statement query which achieve the same query goal. Simplifies multiple operations in 1 query syntax – easy to read and understand. MERGE  INTO  [AdventureWorks].[Person].[Contact_Base]  AS Target   USING ( SELECT  ContactID,Title,FirstName,MiddleName,LastName,EmailAddress  FROM  [AdventureWorks].[Person].[Contact_Temp])  AS Source  (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress)  ON  Target.ContactID = Source.ContactID  WHEN  MATCHED  THEN UPDATE   SET  EmailAddress = Source.EmailAddress  WHEN   NOT  MATCHED  BY  TARGET  THEN   INSERT (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress)  VALUES  (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries LectureFelipe Costa
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)Nalina Kumari
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQLMahir Haque
 
Subqueries, Backups, Users and Privileges
Subqueries, Backups, Users and PrivilegesSubqueries, Backups, Users and Privileges
Subqueries, Backups, Users and PrivilegesAshwin Dinoriya
 
Oracle Course
Oracle CourseOracle Course
Oracle Courserspaike
 
Sas Macro Examples
Sas Macro ExamplesSas Macro Examples
Sas Macro ExamplesSASTechies
 
OER UNIT 4 PARTITION
OER UNIT 4 PARTITIONOER UNIT 4 PARTITION
OER UNIT 4 PARTITIONGirija Muscut
 
Oracle Baisc Tutorial
Oracle Baisc TutorialOracle Baisc Tutorial
Oracle Baisc Tutorialbunny0143
 
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...Massimo Cenci
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-convertedSUSHANTPHALKE2
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideSrinimf-Slides
 
Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Massimo Cenci
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 

La actualidad más candente (20)

Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
 
Proc sql tips
Proc sql tipsProc sql tips
Proc sql tips
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Subqueries, Backups, Users and Privileges
Subqueries, Backups, Users and PrivilegesSubqueries, Backups, Users and Privileges
Subqueries, Backups, Users and Privileges
 
Oracle SQL Part 2
Oracle SQL Part 2Oracle SQL Part 2
Oracle SQL Part 2
 
Oracle Course
Oracle CourseOracle Course
Oracle Course
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
 
Sas Macro Examples
Sas Macro ExamplesSas Macro Examples
Sas Macro Examples
 
Sap abap
Sap abapSap abap
Sap abap
 
OER UNIT 4 PARTITION
OER UNIT 4 PARTITIONOER UNIT 4 PARTITION
OER UNIT 4 PARTITION
 
Ddl commands
Ddl commandsDdl commands
Ddl commands
 
Oracle Baisc Tutorial
Oracle Baisc TutorialOracle Baisc Tutorial
Oracle Baisc Tutorial
 
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...
Data Warehouse and Business Intelligence - Recipe 4 - Staging area - how to v...
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
 
Oracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step GuideOracle PLSQL Step By Step Guide
Oracle PLSQL Step By Step Guide
 
Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3Data Warehouse and Business Intelligence - Recipe 3
Data Warehouse and Business Intelligence - Recipe 3
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
Sql DML
Sql DMLSql DML
Sql DML
 
Sql commands
Sql commandsSql commands
Sql commands
 

Similar a SQL Server 2008 Performance Enhancements

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012Eduardo Castro
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performanceguest9912e5
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standardsAlessandro Baratella
 
Frustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesFrustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesIlya Ganelin
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...SakkaravarthiS1
 
Mohan Testing
Mohan TestingMohan Testing
Mohan Testingsmittal81
 
Whats New on SAP HANA SPS 11 Core Database Capabilities
Whats New on SAP HANA SPS 11 Core Database CapabilitiesWhats New on SAP HANA SPS 11 Core Database Capabilities
Whats New on SAP HANA SPS 11 Core Database CapabilitiesSAP Technology
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Serban Tanasa
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008paulguerin
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Tech Days09 Sqldev
Tech Days09 SqldevTech Days09 Sqldev
Tech Days09 Sqldevllangit
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developersllangit
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developersllangit
 
Be A Hero: Transforming GoPro Analytics Data Pipeline
Be A Hero: Transforming GoPro Analytics Data PipelineBe A Hero: Transforming GoPro Analytics Data Pipeline
Be A Hero: Transforming GoPro Analytics Data PipelineChester Chen
 

Similar a SQL Server 2008 Performance Enhancements (20)

OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
 
Module02
Module02Module02
Module02
 
Sq lite
Sq liteSq lite
Sq lite
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Teradata sql-tuning-top-10
Teradata sql-tuning-top-10Teradata sql-tuning-top-10
Teradata sql-tuning-top-10
 
Frustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesFrustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFrames
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Mohan Testing
Mohan TestingMohan Testing
Mohan Testing
 
Whats New on SAP HANA SPS 11 Core Database Capabilities
Whats New on SAP HANA SPS 11 Core Database CapabilitiesWhats New on SAP HANA SPS 11 Core Database Capabilities
Whats New on SAP HANA SPS 11 Core Database Capabilities
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
 
Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008Myth busters - performance tuning 102 2008
Myth busters - performance tuning 102 2008
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
SQL Tunning
SQL TunningSQL Tunning
SQL Tunning
 
Tech Days09 Sqldev
Tech Days09 SqldevTech Days09 Sqldev
Tech Days09 Sqldev
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developers
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developers
 
Be A Hero: Transforming GoPro Analytics Data Pipeline
Be A Hero: Transforming GoPro Analytics Data PipelineBe A Hero: Transforming GoPro Analytics Data Pipeline
Be A Hero: Transforming GoPro Analytics Data Pipeline
 

Más de infusiondev

Learning by the Lake
Learning by the LakeLearning by the Lake
Learning by the Lakeinfusiondev
 
Toronto Blue Jays Game
Toronto Blue Jays GameToronto Blue Jays Game
Toronto Blue Jays Gameinfusiondev
 
HOPE Volleyball 2011
HOPE Volleyball 2011HOPE Volleyball 2011
HOPE Volleyball 2011infusiondev
 
Infusion Lunch n Learns
Infusion Lunch n LearnsInfusion Lunch n Learns
Infusion Lunch n Learnsinfusiondev
 
Sleepless london 2011
Sleepless london 2011Sleepless london 2011
Sleepless london 2011infusiondev
 
Sleepless London 2011
Sleepless London 2011Sleepless London 2011
Sleepless London 2011infusiondev
 
Infusion Dubai Bootcamp
Infusion Dubai BootcampInfusion Dubai Bootcamp
Infusion Dubai Bootcampinfusiondev
 
Infusion London Casino Night
Infusion London Casino NightInfusion London Casino Night
Infusion London Casino Nightinfusiondev
 
New Toronto Office
New Toronto OfficeNew Toronto Office
New Toronto Officeinfusiondev
 
Infusion New York Casino Night
Infusion New York Casino NightInfusion New York Casino Night
Infusion New York Casino Nightinfusiondev
 
Paintball at Infusion Toronto
Paintball at Infusion TorontoPaintball at Infusion Toronto
Paintball at Infusion Torontoinfusiondev
 
Easter Egg Drop Off
Easter Egg Drop OffEaster Egg Drop Off
Easter Egg Drop Offinfusiondev
 
Infusion Olympics
Infusion OlympicsInfusion Olympics
Infusion Olympicsinfusiondev
 
Infusion Charity Poker Tournament
Infusion Charity Poker TournamentInfusion Charity Poker Tournament
Infusion Charity Poker Tournamentinfusiondev
 
Did You Know - Infusion's Accomplishments in 2010
Did You Know - Infusion's Accomplishments in 2010Did You Know - Infusion's Accomplishments in 2010
Did You Know - Infusion's Accomplishments in 2010infusiondev
 
Top 10 reasons to Join Infusion
Top 10 reasons to Join InfusionTop 10 reasons to Join Infusion
Top 10 reasons to Join Infusioninfusiondev
 
Bing Maps Snapshot
Bing Maps SnapshotBing Maps Snapshot
Bing Maps Snapshotinfusiondev
 
MEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodekinfusiondev
 

Más de infusiondev (20)

Learning by the Lake
Learning by the LakeLearning by the Lake
Learning by the Lake
 
Toronto Blue Jays Game
Toronto Blue Jays GameToronto Blue Jays Game
Toronto Blue Jays Game
 
HOPE Volleyball 2011
HOPE Volleyball 2011HOPE Volleyball 2011
HOPE Volleyball 2011
 
Infusion Lunch n Learns
Infusion Lunch n LearnsInfusion Lunch n Learns
Infusion Lunch n Learns
 
Sleepless london 2011
Sleepless london 2011Sleepless london 2011
Sleepless london 2011
 
Sleepless London 2011
Sleepless London 2011Sleepless London 2011
Sleepless London 2011
 
Infusion Dubai Bootcamp
Infusion Dubai BootcampInfusion Dubai Bootcamp
Infusion Dubai Bootcamp
 
Infusion London Casino Night
Infusion London Casino NightInfusion London Casino Night
Infusion London Casino Night
 
New Toronto Office
New Toronto OfficeNew Toronto Office
New Toronto Office
 
Infusion New York Casino Night
Infusion New York Casino NightInfusion New York Casino Night
Infusion New York Casino Night
 
Paintball at Infusion Toronto
Paintball at Infusion TorontoPaintball at Infusion Toronto
Paintball at Infusion Toronto
 
Easter Egg Drop Off
Easter Egg Drop OffEaster Egg Drop Off
Easter Egg Drop Off
 
Infusion Olympics
Infusion OlympicsInfusion Olympics
Infusion Olympics
 
Infusion Charity Poker Tournament
Infusion Charity Poker TournamentInfusion Charity Poker Tournament
Infusion Charity Poker Tournament
 
Red Nose Day
Red Nose DayRed Nose Day
Red Nose Day
 
Did You Know - Infusion's Accomplishments in 2010
Did You Know - Infusion's Accomplishments in 2010Did You Know - Infusion's Accomplishments in 2010
Did You Know - Infusion's Accomplishments in 2010
 
Top 10 reasons to Join Infusion
Top 10 reasons to Join InfusionTop 10 reasons to Join Infusion
Top 10 reasons to Join Infusion
 
PDAC 2011
PDAC 2011PDAC 2011
PDAC 2011
 
Bing Maps Snapshot
Bing Maps SnapshotBing Maps Snapshot
Bing Maps Snapshot
 
MEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodek
 

SQL Server 2008 Performance Enhancements

  • 1. SQL 2008 Performance Improvements
  • 2.
  • 3.
  • 4.
  • 6.
  • 7.
  • 8.
  • 9. Partitioning Filegroup test1fg test2fg test3fg test4fg Partition Num. 1 2 3 4 Values col1  <= 1 col1  > 1 AND  col1  <= 100 col1  > 100 AND  col1  <= 1000 col1  > 1000
  • 10.
  • 11. Multiple Threads per Partition
  • 12. Multiple Threads per Partition Utilises machines with large number of processors, each thread will run on separate CPU.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Sparse Columns – Decision Table Data type Nonsparse bytes Sparse bytes NULL percentage bit 0.125 4.125 98% tinyint 1 5 86% smallint 2 6 76% int 4 8 64% bigint 8 12 52% real 4 8 64% float 8 12 52% smallmoney 4 8 64% money 8 12 52% smalldatetime 4 8 64% datetime 8 12 52% uniqueidentifier 16 20 43% date 3 7 69%
  • 18.
  • 19.
  • 20.
  • 21. Filtered Indexes CREATE NONCLUSTERED INDEX INDEX_1   ON Production.BillOfMaterials (ComponentID, StartDate)      WHERE EndDate IS NOT NULL ;
  • 22.
  • 23.
  • 24. Sample Existing SP: SELECT TOP 1 * FROM Sales.SalesOrderHeader ORDER BY OrderDate DESC;
  • 25. Sample Override plan: sp_create_plan_guide @name = N'Guide2', @stmt = N'SELECT TOP 1 * FROM Sales.SalesOrderHeader ORDER BY OrderDate DESC', @type = N'SQL', @module_or_batch = NULL, @params = NULL, @hints = N'OPTION (MAXDOP 1)';
  • 26. MERGE Statement Outperforms equivalent multiple statement query which achieve the same query goal. Simplifies multiple operations in 1 query syntax – easy to read and understand. MERGE INTO [AdventureWorks].[Person].[Contact_Base] AS Target USING ( SELECT ContactID,Title,FirstName,MiddleName,LastName,EmailAddress FROM [AdventureWorks].[Person].[Contact_Temp]) AS Source (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress) ON Target.ContactID = Source.ContactID WHEN MATCHED THEN UPDATE SET EmailAddress = Source.EmailAddress WHEN NOT MATCHED BY TARGET THEN INSERT (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress) VALUES (ContactID,Title,FirstName,MiddleName,LastName,EmailAddress);
  • 27.