SlideShare ist ein Scribd-Unternehmen logo
1 von 38
DBA: Boost
 Your Server
Reader Writer Blocking

                                                 Tran2 (Select)
Tran1 (Update)




                 X-Lock   Row-1   S-Lock   Blocked
Read Committed Snapshot

•   New “flavor” of read committed
    • Turn ON/OFF on a database
•   Readers see committed values as of beginning of statement
       • Writers do not block Readers
       • Readers do not block Writers
       • Writers do block writers
•   Can greatly reduce locking / deadlocking without changing
    applications
Demo: RCSI
Lock Escalation

       HOBT         T1: IX                            T1: X




Page    Page        Page     T1: IX


                             T1: X
                               T1: X
                                  T1: X
                                    T1: X
Row     Row          Row               T1: X
                                         T1: X
                                            T1: X
                                              T1: X
Lock Escalation

• Converting finer-grain locks to coarse grain locks.
   • Row to Table
   • Page to Table.
• Benefits
   • Reduced locking overhead
   • Reduces Memory requirement
• Triggered when
   • Number of locks acquired on a rowset > 5000
   • Memory pressure
Partitioned Tables and Indexes

•   SQL Server 2005 introduced partitioning, which some
    customers use to scale a query workload
    • Another common use is to streamline maintenance and enable fast
      range inserts and removals from tables

                                        Partitioned
                                               Table




                     FG1              FG2              FG3
Lock Escalation: The Problem

•   Lock escalation on partitioned tables reduces concurrency as the table lock locks
    ALL partitions
     Query 1                                    Partitioned        Query 2
                                     IX
                                     X                 Table

    update                                                           update
             Partition 1          Partition 2          Partition 3

                           FG1                  FG2                  FG3


•   Only way to solve this in SQL Server 2005 is to disable lock escalation
Lock Escalation: The Solution
•   SQL Server 2008 & up allows lock escalation to the partition level,
    allowing concurrent access to other partitions
      Query 1                                   Partitioned           Query 2
                                    IX                 Table

    update                                                          update
             Partition 1   X     Partition 2          Partition 3

                           FG1                 FG2                  FG3


•   Escalation to partition level does not block queries on other partitions
Demo:
 Partition
Level Lock
Escalation
Filtered Indexes

• An index with a WHERE clause to specify a
  criteria
• Essentially index only a subset of a the table
  • Query optimizer most likely to use when WHERE
    clause matches that of the filtered index
Using Filtered Indexes

• Advantages of Filtered Indexes
  • Improve query performance, partly by
    enhancing execution plan quality
  • Smaller index maintenance costs
  • Less disk storage
Using Filtered Indexes

• Scenarios for Filtered Indexes
  • Sparse columns, where most data is null
  • Columns with categories of values
  • Columns with distinct ranges of values
Demo:
Filtered
Indexes
Optimize for ad hoc workloads


• New server option in    • SP_CONFIGURE 'show advanced
  SQL Server 2008           options',1
                            RECONFIGURE
• Only a stub is cached     GO
                          • SP_CONFIGURE 'optimize for ad
  on first execution        hoc workloads',1
                            RECONFIGURE
• Full plan cached          GO
  after second
  execution
How good is it?
Demo:
Optimize for
  ad hoc
 workload
Configuration:
  Don’t get
 confused!
Configuratio
 n Cheats
Processor Funny Games
TempDB

• Create a file per CPU that SQL Server uses
• Not more than 8
Memory Configuration

• X86? Really?
  • Microsoft Knowledge Base article 274750
Lock Pages in Memory

• Yes/No?
• Enterprise Edition only
  • Can be done on Standard using latest SPs for
    2005/2008 and trace flag 845 for 2008 R2
• AWE is ignored in 64 bit
• The ‘Local System’ account has the ‘lock pages in
  memory’ privilege by default
• Configure MaxServerMemory
Min/Max Memory

• Yes/No?
Min/Max Memory
Min/Max Memory

• Yes/No?
• Keep an eye on Available MB counter
Reason and Solution?

• Note the name Memory (Private Working
  Set) –
  • AWE APIs are used on 64bit to “lock” pages
  • That memory is not part of the working set
• Only trust:
  • Perfmon SQL Server memory counters
  • sys.dm_os_process_memory DMV
Demo:
Lock Pages
 in Memory
Compression
As data volume grows…

• Large databases =
   • Storage Cost
   • Workload
      Performance
  •   Manageability
      Cost
  •   Backup/Recovery
Compression

• Store data efficiently in the
  row/page
  • (+) More data can fit in
    memory
  • (+) Better Performance for I/O
    bound workload
  • (-) Performance degradation
    for CPU bound workload
Data Compression

• SQL Server 2008
  • ROW and PAGE compression
  • Backup Compression
• SQL Server 2008 R2
  • Unicode compression
• SQL Server 2008 R2
  • Spatial indexes compression
Enabling Compression:
               Microsoft’s Perspective
                                             Uncompressed
• Latest partition uncompressed              PAGE Compressed
                                             ROW Compressed

  Jan-Mar   Apr-June   July-Sept   Oct-Dec
Should it be so complex?

In real life – usually compress the entire large
          tables using page compression…
Summary – Compression

•   Can reduce size of database significantly
•   Lower total cost of ownership (TCO)
•   Easy to enable/disable
•   No application changes
•   Performance gains!
Demo:
Compression
SQL Explore 2012: P&T Part 3

Weitere ähnliche Inhalte

Was ist angesagt?

Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ivan Zoratti
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
Morgan Tocker
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
MYXPLAIN
 

Was ist angesagt? (20)

SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4
 
What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4
 
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
Ora mysql bothGetting the best of both worlds with Oracle 11g and MySQL Enter...
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
SQL Server 2019 CTP 2.5
SQL Server 2019 CTP 2.5SQL Server 2019 CTP 2.5
SQL Server 2019 CTP 2.5
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage Engine
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Le novità di sql server 2019
Le novità di sql server 2019Le novità di sql server 2019
Le novità di sql server 2019
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
 
Jss 2015 in memory and operational analytics
Jss 2015   in memory and operational analyticsJss 2015   in memory and operational analytics
Jss 2015 in memory and operational analytics
 
Topic1
Topic1Topic1
Topic1
 
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John NaylorPGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
PGConf.ASIA 2019 Bali - Upcoming Features in PostgreSQL 12 - John Naylor
 
Novedades SQL Server 2014
Novedades SQL Server 2014Novedades SQL Server 2014
Novedades SQL Server 2014
 
What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3What’s New In PostgreSQL 9.3
What’s New In PostgreSQL 9.3
 
Manageability Enhancements of SQL Server 2012
Manageability Enhancements of SQL Server 2012Manageability Enhancements of SQL Server 2012
Manageability Enhancements of SQL Server 2012
 
Converting from MySQL to PostgreSQL
Converting from MySQL to PostgreSQLConverting from MySQL to PostgreSQL
Converting from MySQL to PostgreSQL
 
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityLVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
 
DB210 Smarter Database IBM Tech Forum 2011
DB210 Smarter Database   IBM Tech Forum 2011DB210 Smarter Database   IBM Tech Forum 2011
DB210 Smarter Database IBM Tech Forum 2011
 

Andere mochten auch (10)

DAC 2012
DAC 2012DAC 2012
DAC 2012
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserver
 
Things you can find in the plan cache
Things you can find in the plan cacheThings you can find in the plan cache
Things you can find in the plan cache
 
Sql server user group news january 2013
Sql server user group news   january 2013Sql server user group news   january 2013
Sql server user group news january 2013
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013
 
3 where are my keys - sql explore
3   where are my keys - sql explore3   where are my keys - sql explore
3 where are my keys - sql explore
 
3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd
 
7 sql azure for sql explore
7   sql azure for sql explore7   sql azure for sql explore
7 sql azure for sql explore
 
Lessons learned from running massive WordPress sites at scale
Lessons learned from running massive WordPress sites at scaleLessons learned from running massive WordPress sites at scale
Lessons learned from running massive WordPress sites at scale
 

Ähnlich wie SQL Explore 2012: P&T Part 3

Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OSIDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
Cuneyt Goksu
 

Ähnlich wie SQL Explore 2012: P&T Part 3 (20)

DbB 10 Webcast #3 The Secrets Of Scalability
DbB 10 Webcast #3   The Secrets Of ScalabilityDbB 10 Webcast #3   The Secrets Of Scalability
DbB 10 Webcast #3 The Secrets Of Scalability
 
Dutch Lotus User Group 2009 - Domino Tuning Presentation
Dutch Lotus User Group 2009 - Domino Tuning PresentationDutch Lotus User Group 2009 - Domino Tuning Presentation
Dutch Lotus User Group 2009 - Domino Tuning Presentation
 
Hive: Loading Data
Hive: Loading DataHive: Loading Data
Hive: Loading Data
 
30334823 my sql-cluster-performance-tuning-best-practices
30334823 my sql-cluster-performance-tuning-best-practices30334823 my sql-cluster-performance-tuning-best-practices
30334823 my sql-cluster-performance-tuning-best-practices
 
Databases love nutanix
Databases love nutanixDatabases love nutanix
Databases love nutanix
 
45 ways to speed up firebird database
45 ways to speed up firebird database45 ways to speed up firebird database
45 ways to speed up firebird database
 
CLFS 2010
CLFS 2010CLFS 2010
CLFS 2010
 
Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph Ceph Community Talk on High-Performance Solid Sate Ceph
Ceph Community Talk on High-Performance Solid Sate Ceph
 
DB2 10 Smarter Database - IBM Tech Forum
DB2 10 Smarter Database   - IBM Tech ForumDB2 10 Smarter Database   - IBM Tech Forum
DB2 10 Smarter Database - IBM Tech Forum
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
DB2 10 Webcast #1 Overview And Migration Planning
DB2 10 Webcast #1   Overview And Migration PlanningDB2 10 Webcast #1   Overview And Migration Planning
DB2 10 Webcast #1 Overview And Migration Planning
 
DB2 10 Webcast #1 - Overview And Migration Planning
DB2 10 Webcast #1 - Overview And Migration PlanningDB2 10 Webcast #1 - Overview And Migration Planning
DB2 10 Webcast #1 - Overview And Migration Planning
 
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OSIDUG NA 2014 / 11 tips for DB2 11 for z/OS
IDUG NA 2014 / 11 tips for DB2 11 for z/OS
 
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
VMworld 2013: Just Because You Could, Doesn't Mean You Should: Lessons Learne...
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
 
Loadays MySQL
Loadays MySQLLoadays MySQL
Loadays MySQL
 
Some key value stores using log-structure
Some key value stores using log-structureSome key value stores using log-structure
Some key value stores using log-structure
 
Make Oracle scream with Flash Storage - Kaminario
Make Oracle scream with Flash Storage - KaminarioMake Oracle scream with Flash Storage - Kaminario
Make Oracle scream with Flash Storage - Kaminario
 
UKGSE DB2 pureScale
UKGSE DB2 pureScaleUKGSE DB2 pureScale
UKGSE DB2 pureScale
 

Mehr von sqlserver.co.il

SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
sqlserver.co.il
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
sqlserver.co.il
 
SQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStoreSQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStore
sqlserver.co.il
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
sqlserver.co.il
 
SQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: SpatialSQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: Spatial
sqlserver.co.il
 
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf FraenkelBi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
sqlserver.co.il
 
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
sqlserver.co.il
 
Extreme performance - IDF UG
Extreme performance - IDF UGExtreme performance - IDF UG
Extreme performance - IDF UG
sqlserver.co.il
 
3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd
sqlserver.co.il
 
4 extreme performance - part ii
4   extreme performance - part ii4   extreme performance - part ii
4 extreme performance - part ii
sqlserver.co.il
 
2 extreme performance - smaller is better
2   extreme performance - smaller is better2   extreme performance - smaller is better
2 extreme performance - smaller is better
sqlserver.co.il
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
sqlserver.co.il
 
6 sql explorer - powershell dba
6   sql explorer - powershell dba6   sql explorer - powershell dba
6 sql explorer - powershell dba
sqlserver.co.il
 
4 sql explore סודות האופטימייזר
4   sql explore סודות האופטימייזר4   sql explore סודות האופטימייזר
4 sql explore סודות האופטימייזר
sqlserver.co.il
 

Mehr von sqlserver.co.il (20)

SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
 
SQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStoreSQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStore
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
 
SQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: SpatialSQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: Spatial
 
מיכאל
מיכאלמיכאל
מיכאל
 
נועם
נועםנועם
נועם
 
עדי
עדיעדי
עדי
 
מיכאל
מיכאלמיכאל
מיכאל
 
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf FraenkelBi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
 
DBCC - Dubi Lebel
DBCC - Dubi LebelDBCC - Dubi Lebel
DBCC - Dubi Lebel
 
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
 
ISUG 113: File stream
ISUG 113: File streamISUG 113: File stream
ISUG 113: File stream
 
Extreme performance - IDF UG
Extreme performance - IDF UGExtreme performance - IDF UG
Extreme performance - IDF UG
 
3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd
 
4 extreme performance - part ii
4   extreme performance - part ii4   extreme performance - part ii
4 extreme performance - part ii
 
2 extreme performance - smaller is better
2   extreme performance - smaller is better2   extreme performance - smaller is better
2 extreme performance - smaller is better
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
6 sql explorer - powershell dba
6   sql explorer - powershell dba6   sql explorer - powershell dba
6 sql explorer - powershell dba
 
4 sql explore סודות האופטימייזר
4   sql explore סודות האופטימייזר4   sql explore סודות האופטימייזר
4 sql explore סודות האופטימייזר
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

SQL Explore 2012: P&T Part 3

  • 2. Reader Writer Blocking Tran2 (Select) Tran1 (Update) X-Lock Row-1 S-Lock Blocked
  • 3. Read Committed Snapshot • New “flavor” of read committed • Turn ON/OFF on a database • Readers see committed values as of beginning of statement • Writers do not block Readers • Readers do not block Writers • Writers do block writers • Can greatly reduce locking / deadlocking without changing applications
  • 5. Lock Escalation HOBT T1: IX T1: X Page Page Page T1: IX T1: X T1: X T1: X T1: X Row Row Row T1: X T1: X T1: X T1: X
  • 6. Lock Escalation • Converting finer-grain locks to coarse grain locks. • Row to Table • Page to Table. • Benefits • Reduced locking overhead • Reduces Memory requirement • Triggered when • Number of locks acquired on a rowset > 5000 • Memory pressure
  • 7. Partitioned Tables and Indexes • SQL Server 2005 introduced partitioning, which some customers use to scale a query workload • Another common use is to streamline maintenance and enable fast range inserts and removals from tables Partitioned Table FG1 FG2 FG3
  • 8. Lock Escalation: The Problem • Lock escalation on partitioned tables reduces concurrency as the table lock locks ALL partitions Query 1 Partitioned Query 2 IX X Table update update Partition 1 Partition 2 Partition 3 FG1 FG2 FG3 • Only way to solve this in SQL Server 2005 is to disable lock escalation
  • 9. Lock Escalation: The Solution • SQL Server 2008 & up allows lock escalation to the partition level, allowing concurrent access to other partitions Query 1 Partitioned Query 2 IX Table update update Partition 1 X Partition 2 Partition 3 FG1 FG2 FG3 • Escalation to partition level does not block queries on other partitions
  • 11. Filtered Indexes • An index with a WHERE clause to specify a criteria • Essentially index only a subset of a the table • Query optimizer most likely to use when WHERE clause matches that of the filtered index
  • 12. Using Filtered Indexes • Advantages of Filtered Indexes • Improve query performance, partly by enhancing execution plan quality • Smaller index maintenance costs • Less disk storage
  • 13. Using Filtered Indexes • Scenarios for Filtered Indexes • Sparse columns, where most data is null • Columns with categories of values • Columns with distinct ranges of values
  • 15. Optimize for ad hoc workloads • New server option in • SP_CONFIGURE 'show advanced SQL Server 2008 options',1 RECONFIGURE • Only a stub is cached GO • SP_CONFIGURE 'optimize for ad on first execution hoc workloads',1 RECONFIGURE • Full plan cached GO after second execution
  • 16. How good is it?
  • 17. Demo: Optimize for ad hoc workload
  • 18. Configuration: Don’t get confused!
  • 21. TempDB • Create a file per CPU that SQL Server uses • Not more than 8
  • 22. Memory Configuration • X86? Really? • Microsoft Knowledge Base article 274750
  • 23. Lock Pages in Memory • Yes/No? • Enterprise Edition only • Can be done on Standard using latest SPs for 2005/2008 and trace flag 845 for 2008 R2 • AWE is ignored in 64 bit • The ‘Local System’ account has the ‘lock pages in memory’ privilege by default • Configure MaxServerMemory
  • 26. Min/Max Memory • Yes/No? • Keep an eye on Available MB counter
  • 27.
  • 28. Reason and Solution? • Note the name Memory (Private Working Set) – • AWE APIs are used on 64bit to “lock” pages • That memory is not part of the working set • Only trust: • Perfmon SQL Server memory counters • sys.dm_os_process_memory DMV
  • 31. As data volume grows… • Large databases = • Storage Cost • Workload Performance • Manageability Cost • Backup/Recovery
  • 32. Compression • Store data efficiently in the row/page • (+) More data can fit in memory • (+) Better Performance for I/O bound workload • (-) Performance degradation for CPU bound workload
  • 33. Data Compression • SQL Server 2008 • ROW and PAGE compression • Backup Compression • SQL Server 2008 R2 • Unicode compression • SQL Server 2008 R2 • Spatial indexes compression
  • 34. Enabling Compression: Microsoft’s Perspective Uncompressed • Latest partition uncompressed PAGE Compressed ROW Compressed Jan-Mar Apr-June July-Sept Oct-Dec
  • 35. Should it be so complex? In real life – usually compress the entire large tables using page compression…
  • 36. Summary – Compression • Can reduce size of database significantly • Lower total cost of ownership (TCO) • Easy to enable/disable • No application changes • Performance gains!

Hinweis der Redaktion

  1. No escalation from Row to PageEach lock structure is 100 bytesNumber of locks acquired on a rowset > 5000 - Periodically after that
  2. Self-explanatory. See Books Online for more details about partitioning. Also see http://msdn2.microsoft.com/en-us/library/ms345146.aspx
  3. Query 1 is updating partition 1. It hits the escalation threshold and escalates to a TABLE X lock. Query 2 tries to update partition 3 and can’t because of the table X lock, even though nothing in partition 3 is being altered by query 1.
  4. Instead of escalating to the table level and blocking all other queries on the table, you can now choose to have escalation to the partition level, which allows concurrent queries on different partitions.