45
SQL Server 2012 Performance tuning Michelle Gutzait [email protected] [email protected] Blog: http://michelle-gutzait.spaces.live.com/default.aspx

SQL Server 2012 Performance tuning Michelle Gutzait

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 2: SQL Server 2012 Performance tuning Michelle Gutzait

Whoami?

SQL Server Consultant@ www.pythian.com

24/7 Remote DBA services

Page 3: SQL Server 2012 Performance tuning Michelle Gutzait

- Database Tuning advisor (DTA) Enhancements

- Column store indexes

- Online index operations

New in SQL 2012

Page 4: SQL Server 2012 Performance tuning Michelle Gutzait

Servers

Applications

Users

WEB

Users

Page 5: SQL Server 2012 Performance tuning Michelle Gutzait

Server is too slow Something is broken

Application crashes Weird behavior Timeouts

Heavy process

Page 6: SQL Server 2012 Performance tuning Michelle Gutzait
Page 7: SQL Server 2012 Performance tuning Michelle Gutzait
Page 8: SQL Server 2012 Performance tuning Michelle Gutzait
Page 9: SQL Server 2012 Performance tuning Michelle Gutzait
Page 10: SQL Server 2012 Performance tuning Michelle Gutzait

Windows Performance Monitor

SQL Server Profiler &

SQL Traces

ReadTrace

SQL Server Management Studio

Windows Management Instrumentation

(WMI)

Page 11: SQL Server 2012 Performance tuning Michelle Gutzait

Database Engine Tuning Advisor

DMVs and statistics

SQL Server 2008 Activity Monitor

SQL Server 2008 and R2 Ent tools…

Page 12: SQL Server 2012 Performance tuning Michelle Gutzait

PSSDiag

SQLDiag and PerfStats

Performance Analysis of Logs

(PAL)

Page 13: SQL Server 2012 Performance tuning Michelle Gutzait

SQL Nexus

Performance

Dashboard

Page 14: SQL Server 2012 Performance tuning Michelle Gutzait

3-rd party tool

Page 15: SQL Server 2012 Performance tuning Michelle Gutzait

The search engine…

Page 16: SQL Server 2012 Performance tuning Michelle Gutzait

So also… SCRIPT REPOSITORIES

Page 17: SQL Server 2012 Performance tuning Michelle Gutzait

Index and T-SQL

Analysis with

DMVs

Page 18: SQL Server 2012 Performance tuning Michelle Gutzait

SQL Server 2005/2008 Index analysis - Database Tuning Advisor

Page 19: SQL Server 2012 Performance tuning Michelle Gutzait
Page 20: SQL Server 2012 Performance tuning Michelle Gutzait
Page 21: SQL Server 2012 Performance tuning Michelle Gutzait

Significant enhancement

Page 22: SQL Server 2012 Performance tuning Michelle Gutzait
Page 23: SQL Server 2012 Performance tuning Michelle Gutzait

Reads/writes (IO)

Page 24: SQL Server 2012 Performance tuning Michelle Gutzait

Large IO

Index design

Index and disk fragmentation

Query design

Heavy user activity

Page 25: SQL Server 2012 Performance tuning Michelle Gutzait

Disk Contention

Memory constraints

Large indexes and tables

Network contention

Blocks/locks/deadlocks

Page 26: SQL Server 2012 Performance tuning Michelle Gutzait

Index / Data

Page =

8K

Page 27: SQL Server 2012 Performance tuning Michelle Gutzait

All

columns of

the index

key are in

one row

Page 28: SQL Server 2012 Performance tuning Michelle Gutzait

Minimizing

IO

Page 29: SQL Server 2012 Performance tuning Michelle Gutzait
Page 30: SQL Server 2012 Performance tuning Michelle Gutzait

Traditional index ColumnStore

Page 31: SQL Server 2012 Performance tuning Michelle Gutzait

Optimized for star schema design

Data Compression

Batch Execution Mode

Segment Elimination

Page 32: SQL Server 2012 Performance tuning Michelle Gutzait

Data Compression Compress and store data in memory with Vertipaq™

technology

High compression for repetitive values

Page 33: SQL Server 2012 Performance tuning Michelle Gutzait

Batch Execution Mode

Batch vs. Row Mode

Batch = around 1000 rows

Vector-based structure in-memory

Processed all at once

Up to 40 times CPU reduction

Optimized with large memory and multicores

DOP >= 2

Page 34: SQL Server 2012 Performance tuning Michelle Gutzait

Segment Elimination

Indexes are partitioned into segments

Page 35: SQL Server 2012 Performance tuning Michelle Gutzait
Page 36: SQL Server 2012 Performance tuning Michelle Gutzait

Clustering

Database

mirroring

Log

Shipping

Disk mirroring

Replication Database

Snapshots

3-rd party

solutions

Always ON

Page 37: SQL Server 2012 Performance tuning Michelle Gutzait

Integrity checks

Update Stats

Backups

Index

maintenance Clean History

Data archive

Patching

Upgrades/move

Page 38: SQL Server 2012 Performance tuning Michelle Gutzait

An

available

running

database

Page 39: SQL Server 2012 Performance tuning Michelle Gutzait

CREATE INDEX

ALTER INDEX

DROP INDEX

ALTER TABLE

(UNIQUE/PRIMARY

keys)

Page 40: SQL Server 2012 Performance tuning Michelle Gutzait
Page 41: SQL Server 2012 Performance tuning Michelle Gutzait

Large Value Type column *VAR*(MAX)

PRINT @@VERSION

go

-- Create a Table

CREATE TABLE Items

(

ItemID INT IDENTITY,

ItemName VARCHAR(100),

VarcharData VARCHAR(max)

)

go

-- Create an Index

CREATE NONCLUSTERED INDEX

[IDX_ItemIdxTest]

ON [dbo].[Items] ( [ItemID] ASC,

[ItemName] ASC )

include ( [VarcharData] )

WITH ( ONLINE = ON )

go

SQL < 2012

Page 42: SQL Server 2012 Performance tuning Michelle Gutzait
Page 43: SQL Server 2012 Performance tuning Michelle Gutzait

Always On

Increased number of partitions (15,000 vs. 1000)

Indirect checkpoints for database recovery time

Geographically dispersed Clustering

New in SQL 2012

Page 44: SQL Server 2012 Performance tuning Michelle Gutzait

And more…