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 · PDF fileSQL Server 2012 Performance tuning Michelle Gutzait [email protected] [email protected] Blog:

Embed Size (px)

Citation preview

Whoami?

SQL Server Consultant@ www.pythian.com

24/7 Remote DBA services

- Database Tuning advisor (DTA) Enhancements

- Column store indexes

- Online index operations

New in SQL 2012

Servers

Applications

Users

WEB

Users

Server is too slow Something is broken

Application crashes Weird behavior Timeouts

Heavy process

Windows Performance Monitor

SQL Server Profiler &

SQL Traces

ReadTrace

SQL Server Management Studio

Windows Management Instrumentation

(WMI)

Database Engine Tuning Advisor

DMVs and statistics

SQL Server 2008 Activity Monitor

SQL Server 2008 and R2 Ent tools…

PSSDiag

SQLDiag and PerfStats

Performance Analysis of Logs

(PAL)

SQL Nexus

Performance

Dashboard

3-rd party tool

The search engine…

So also… SCRIPT REPOSITORIES

Index and T-SQL

Analysis with

DMVs

SQL Server 2005/2008 Index analysis - Database Tuning Advisor

Significant enhancement

Reads/writes (IO)

Large IO

Index design

Index and disk fragmentation

Query design

Heavy user activity

Disk Contention

Memory constraints

Large indexes and tables

Network contention

Blocks/locks/deadlocks

Index / Data

Page =

8K

All

columns of

the index

key are in

one row

Minimizing

IO

Traditional index ColumnStore

Optimized for star schema design

Data Compression

Batch Execution Mode

Segment Elimination

Data Compression Compress and store data in memory with Vertipaq™

technology

High compression for repetitive values

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

Segment Elimination

Indexes are partitioned into segments

Clustering

Database

mirroring

Log

Shipping

Disk mirroring

Replication Database

Snapshots

3-rd party

solutions

Always ON

Integrity checks

Update Stats

Backups

Index

maintenance Clean History

Data archive

Patching

Upgrades/move

An

available

running

database

CREATE INDEX

ALTER INDEX

DROP INDEX

ALTER TABLE

(UNIQUE/PRIMARY

keys)

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

Always On

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

Indirect checkpoints for database recovery time

Geographically dispersed Clustering

New in SQL 2012

And more…