How to solve a SQL performance problemPaul Zgondea
Agenda
• DBA monitoring tools• Finding the culprit • Optimization time
First Response of a DBA
• What do you do when somebody asks you to investigate what’s stressing out the SQL server? • What tools do you use ? • What do you do when the SQL Server is too busy to accept your
connection ?
Dedicated Admin Connection
• Enable DACEXEC sp_configure 'remote admin connections', 1;GORECONFIGUREGO
sp_whoisactive by Adam Machanic
• Alternative for sp_who and sp_who2 • Why it’s better: • Runs quickly and does not use a lot of resources.• Shows only the active queries (no sleeping and system processes)• Shows how long the queries have been running for• Shows the formatted SQL Text and Plan (@get_plans = 1)• Shows waits information • Shows CPU, Tempdb information,
DEMO TIME
Capture the events
• Extended events – fast, asynchronous – steep learning curve. • SQL Trace / Profiler – old method but still used – synchronous and it
adds extra load on the server.
Analyze the captured data
• Retrieve the captured data• Filter, clean and group data so we can analyze it accordingly • Identify the most resource intensive queries
Optimization time!
• Execution plan • Indexes • Re-writes • Testing the final result
DEMO TIME
Thank you for attending!
Resources will be available soon on WWW.SQLCLUJ.COM