Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What tools are available to test SQL statement performance?

In the never-ending search for performance (and my own bludgeoning experience), I've learnt a few things that could drag down the performance of a SQL statement.

Obsessive Compulsive Subqueries Disorder
Doing crazy type conversions (and nest those into oblivion)
Group By on aggregate functions of said crazy type conversions
Where fldID in (select EVERYTHING from my 5mil record table)

I typically work with MSSQL. What tools are available to test the performance of a SQL statement? Are these tools built in and specific to each type of DB server? Or are there general tools available?

like image 517
MoSlo Avatar asked Oct 12 '09 16:10

MoSlo


2 Answers

SQL Profiler (built-in): Monitoring with SQL Profiler

SQL Benchmark Pro (Commercial)

SQL Server 2008 has the new Data Collector

SQL Server 2005 (onwards) has a missing indexes Dynamic Management View (DMV) which can be quite useful (but only for query plans currently in the plan cache): About the Missing Indexes Feature.

There is also the SQL Server Database Engine Tuning Advisor which does a reasonable job (just don't implement everything it suggests!)

like image 85
Mitch Wheat Avatar answered Sep 28 '22 07:09

Mitch Wheat


I mostly just use Profiler and the execution plan viewer

like image 27
Galwegian Avatar answered Sep 28 '22 08:09

Galwegian