Upload
stacy-gray
View
1.874
Download
1
Embed Size (px)
Citation preview
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information in this document, including URL and other Internet Web site references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
© 2013 Microsoft Corporation. All rights reserved.
Microsoft and other Microsoft products referenced herein are trademarks of the Microsoft group of companies.
All other trademarks are property of their respective owners.
Disclaimer
PSSDiagSQL Nexus
What does it collect?
Server
Configuration
PerfStats
Script
Event Logs Performance Monitor
Profiler Trace Error Logs
http://www.microsoft.com/en-us/download/details.aspx?id=4511
http://sqlnexus.codeplex.com/
http://diagmanager.codeplex.com/
It’s all about
the bottleneck
• Look for high number of logical reads
• Could be heavy compiles
• Could be stale statistics
Find the most expensive
query
Start Time: 8/28/2015 3:39:27 AM
End Time: 8/28/2015 3:41:35 AM
Top N: 5
Trace Event ID
58
33
55
79
69
166SQL:StmtRecompile 134
Sort Warnings 121
Missing Column Statistics 39
Hash Warning 8
Exception 33
Event Name Number of Events
Auto Stats 12
Interesting Events Parameters Value
sqlnexus
What can I do?
Enable Optimize
for Adhoc
Workloads
Parameterization:
Forced
• Look for scans, hashes, sorts or expensive operators
in plan
• Look for high number of logical reads
• Could be heavy compiles
Find the most
expensive
query
• Incorrect cardinality estimation a top issue
• Missing indexes or out of date stats
• May be a query design issue
• Parallel queries may take over the machine
Common
issues
• Tune indexes, stats, and/or query
• Limiting MAXDOP for parallel queries is temporary
• Apply a hotfix build
• Parameterize the query to reduce compiles
Common
Solutions
What if I don’t have high
CPU?
Server test
Version (SP) 10.50.4033.0 (SP2)
Database Io Stall Write
MS
9728
1668117
21634
1981
31151
3527
16197332
4998212
15620
2677
8914
1322
16105301
4129583
1354
929
26806
12355
40130
13914
4922013
8981765
281077
731547
117129995
70134865
57652
3885142
22398
17956
481720
381234
5787266017
5786113560
5785960247
5787337436
5785950704
5789762688
5786332154
5787772010
5786279150
5787097163
5789463367
5788817205
188508903%drive%\folder\name 69 503259 189012162
%drive%\folder\name 3540 5333884 5794797251
%drive%\folder\name 3540 5367121 5794184326
%drive%\folder\name 3541 5160621 5791439771
%drive%\folder\name 3540 5533804 5792630967
%drive%\folder\name 3541 5148116 5791480270
%drive%\folder\name 3541 5121586 5792893596
%drive%\folder\name 3542 5393845 5791344549
%drive%\folder\name 3542 5422169 5795184857
3543 5266074 5791226321
%drive%\folder\name 3543 5153100 5792490536
tempdb %drive%\folder\name 3544 5235544 5792501561
%drive%\folder\name 3544 5464094 5791577654
%drive%\folder\name
msdb %drive%\folder\name 84 541860 1023580
%drive%\folder\name 45 725 381959
model %drive%\folder\name 46 23110 45508
%drive%\folder\name 38 2764 20720
master %drive%\folder\name 93 127712 185364
%drive%\folder\name 65 3121 3888263
db9 %drive%\folder\name 155 2327209010 2444339005
%drive%\folder\name 8 2291590 72426455
db8 %drive%\folder\name 70 7502681 7783758
%drive%\folder\name 7 58688 790235
db7 %drive%\folder\name 74 347820645 352742658
%drive%\folder\name 1 266082 9247847
db6 %drive%\folder\name 44 254850721 254890851
%drive%\folder\name 0 10243 24157
db5 %drive%\folder\name 47 273913948 273940754
%drive%\folder\name 0 1707 14062
db17 %drive%\folder\name 17 974720 976074
%drive%\folder\name 3 318 1247
db16 %drive%\folder\name 50 81051902 97157203
%drive%\folder\name 11 189206 4318789
db15 %drive%\folder\name 40 81011 89925
%drive%\folder\name 3 391 1713
db14 %drive%\folder\name 38 14309 29929
%drive%\folder\name 6 458 3135
4233
db13 %drive%\folder\name 66 29135356 45332688
%drive%\folder\name 4 1494983 6493195
164 2145
db12 %drive%\folder\name 117 747305 778456
%drive%\folder\name 2 706
0 25899 1694016
db11 %drive%\folder\name 206 29862211 29883845
%drive%\folder\name 1
file Avg IOTime MS Io Stall Read MS Io Stall MS
db10 %drive%\folder\name 10 13355 23083
%drive%\folder\name
SQL Server Virtual Fle StatsStart Time 7/9/2015 6:00:35 AM
End Time 7/9/2015 7:18:08 AM
This report displays Virtual File Stats snapshots. By default, it displays last snapshot. But you can display other snapshots by changing Snapshot Time parameter.
• Is it waiting on another resource?
• Is it idle?
• Is it running?
Find the lead blocker
• Transaction not committed or long running transaction
• Waiting on another resource
• Poor query plan
• Basic concurrency is “working”
Common issues
• Tune index, stats, and/or query
• Application design (Ex. Fix commit tran problem)
• Consider READ_COMMITTED_SNAPSHOT db option
Typical Solutions
What if I don’t have
blocking?
Deadlocks start as
blocking . Almost
always app
problem.
A large blocking
chain can lead
to a “hang” as
seen in
ERRORLOG
Turtle
High Sec/T + High Bytes/Sec =
SQL Flood High Sec/T + Low Bytes/Sec =
Disk Subsystem
This is starting to sound familiar…
Not enough
cache for data
Physical read counters
Buffer Cache Hit Ratio is
misleading
Check ‘max server
memory’
Not enough
cache for
queries
Check compilations/sec
Too many ad-hoc queries
Engine has forced limits
Forced Parameterization
and optimize for ad hoc
workloads
Memory
throttles lead
to blocking
Compile memory
Query memory (sorts and
hash joins)
• DMVs, sp_updatestats, UPDATE STATS, and
“auto stats”Update Stats
• DMVs, SHOWPLAN, and DTACreate missing
indexes
• Change T-SQL, Query Hints, Plan GuidesChange query
Tune index,
stats, query
Change application
Often required for
blocking/deadlocks
Tune hardware
CPU, Memory, I/O
Don’t just jump
to any of
these!
• Prompts for password
• Must be able to login into target instances
• Must be a member of the sysadmin role
• Must be a member of Administrators
Test
5GBNo
kitchen sink
PSSdiag /B 14:00:00
PSSdiag /E +02:00:00
PSSdiag /B 08:00:00 /E +09:00:00
PSSdiag /E 02:00:00 /L /Q
All command line parameters:
http://msdn.microsoft.com/en-us/library/ms162833.aspx