achieving gold medal performance from sql server

21
SQLDBApros 1 SQL Server DBA Professionals 3 Tips for Getting Gold Medal Performance From Your SQL Server Installation Adapted From Work by SQL Server Experts: Patrick O’Keefe Richard Douglas

Upload: sqldbapros

Post on 14-Dec-2014

1.593 views

Category:

Technology


1 download

DESCRIPTION

You can’t go wrong by starting with these SQL Server performance tips, which offer DBAs and others detailed information on specific issues and ways to apply them to their environment.

TRANSCRIPT

Page 1: Achieving Gold Medal Performance From SQL Server

SQLDBApros1SQL Server DBA Professionals

3 Tips for Getting Gold Medal Performance From Your SQL Server Installation

Adapted From Work by SQL Server Experts:

Patrick O’Keefe Richard Douglas

Page 2: Achieving Gold Medal Performance From SQL Server

SQLDBApros2

Gold Medal Tip #1: Benchmark and Analyze Your Performance

Page 3: Achieving Gold Medal Performance From SQL Server

SQLDBApros3

Establish a performance baseline –

The more predictable your performance, the less data you will require.

administrators, end users, and application administers

Talk to system

get a feel forusage patterns/peak-periods/off hours/average use

Page 4: Achieving Gold Medal Performance From SQL Server

SQLDBApros4

Consider capacity –

How will it grow over time?

How much is required to store the data?

Consider aggregating historical data in intervals

Do not store measurement repository in same location as the database you are measuring.

Page 5: Achieving Gold Medal Performance From SQL Server

SQLDBApros5

Limit your changes –

Rule out ineffective methods

Test one hypothesis on each run

Honing each change reveals additional improvement options.

Page 6: Achieving Gold Medal Performance From SQL Server

SQLDBApros6

Repeat the measurements –

Objectively determine whether or not you made progress.

Did you get the desired effect?

Compare original run and changed run

Have any unexpected side effects?

Page 7: Achieving Gold Medal Performance From SQL Server

SQLDBApros7

Establish performance norms –

Extrapolate typical resource consumption per user – predict when your system will hit connection bottlenecks.

enable perfect performance?

What conditions

what scenarios hinder it?

Perform capacity planning

Page 8: Achieving Gold Medal Performance From SQL Server

SQLDBApros8

Rule out usual suspects –

Drill down into the root cause.

more effectivelyTroubleshoot problems

Search for significant deviationsfrom baseline

Group related indicators

Page 9: Achieving Gold Medal Performance From SQL Server

SQLDBApros9

Gold Medal Tip #2: Find the Rogue Query

Page 10: Achieving Gold Medal Performance From SQL Server

SQLDBApros10

Find workload causing the bottleneck –

For a CPU bottleneck, the first thing is to get top CPU consumers on the server

Management Objects (DMOs) in SQL Server 2005

This is a lot easier to do since the introduction of Dynamic

Page 11: Achieving Gold Medal Performance From SQL Server

SQLDBApros11

Top CPU consumers query –

The really useful part of this query is your ability to use cross apply and sys.dm_exec_sql_text to get the SQL statement, so you can analyze it.

This is a very simple query on sys.dm_exec_ query_stats:

Page 12: Achieving Gold Medal Performance From SQL Server

SQLDBApros12

I/O bottleneck –

Page 13: Achieving Gold Medal Performance From SQL Server

SQLDBApros13

Gold Medal Tip #3: Utilize SQL Server Profiler

Page 14: Achieving Gold Medal Performance From SQL Server

SQLDBApros14

SQL Server Profiler –

View a video tutorial on SQL Server Profiler on Toad World.

captures events in SQL Server,

Profiler creates a trace file that

proving invaluablein providing information on workload and poorly performing queries.

Page 15: Achieving Gold Medal Performance From SQL Server

SQLDBApros15

Performance monitor –

Note* running Profiler requires the ALTER TRACE permission.

collect data and correlate information on resource usage

Perfmon allows you to

being fired inside SQL Server

with data on the events

Page 16: Achieving Gold Medal Performance From SQL Server

SQLDBApros16

Here’s how…

1. Open Perfmon.2. Prepare Data Collector Set or create a new one. DO NOT start set yet.3. Open Profiler.4. Create a new trace – specify instance, event, column, & destination details.

Page 17: Achieving Gold Medal Performance From SQL Server

SQLDBApros17

5. Start the trace.6. Switch back to Perfmon and start the Data Collector set.7. Leave both sessions running until required data has been collected.8. Stop the Profiler trace, save, and close. 9. Switch to Perfom, stop the Data Collector set.

Page 18: Achieving Gold Medal Performance From SQL Server

SQLDBApros18

10. Open the saved trace in Profiler.11. Click File Import Performance Data.12. Navigate to Data Collection File, select performance counters of interest.

Page 19: Achieving Gold Medal Performance From SQL Server

SQLDBApros19

You can now see the performance counters with the Profiler trace file (figure below) – enabling much faster

resolution of bottlenecks.

Page 20: Achieving Gold Medal Performance From SQL Server

SQLDBApros20

Extra tip –

For more details and seven other great tips, Download our Whitepaper.

to save resources…The steps above use the client interface…

a server wide trace would be more efficient.

Page 21: Achieving Gold Medal Performance From SQL Server

21

Learn More

SQL Server Tools– Free TrialFollow us on Twitter @SQLDBApros