How to measure Store Procedure execution time?

How to measure Store Procedure execution time?

Post by Rollin 4 Ev » Wed, 10 Jul 2002 00:40:10



I'm trying to compare the execution times of two different queries on the
same database.  Is there something in Query Analyzer or Enterprise Manager
that can do this?
 
 
 

How to measure Store Procedure execution time?

Post by Luc » Wed, 10 Jul 2002 01:20:08


Programmatically (QA) take a look at:

SET STATISTICS TIME
SET STATISTICS PROFILE
SET STATISTICS IO

You can also choose in QA 'Query / Show Clients Statistics'.



Quote:> I'm trying to compare the execution times of two different queries on the
> same database.  Is there something in Query Analyzer or Enterprise Manager
> that can do this?


 
 
 

How to measure Store Procedure execution time?

Post by Erland Sommarsko » Wed, 10 Jul 2002 06:19:51



Quote:> I'm trying to compare the execution times of two different queries on the
> same database.  Is there something in Query Analyzer or Enterprise Manager
> that can do this?

I usually use SELECT getdate() in strategic places. Sometimes I might to


   EXEC test_stuff


Also, be sure to say DBCC DROPCLEANBUFFERS between the runs, else the
2nd versio can appear much faster, because the 1st version brought all
data pages into cache from disk.

--
Erland Sommarskog, SQL Server MVP

Books Online (updated!) for SQL 2000 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 
 
 

How to measure Store Procedure execution time?

Post by BP Margoli » Wed, 10 Jul 2002 09:43:21


It's a good idea to do a DBCC FREEPROCCACHE in addition to DBCC
DROPCLEANBUFFERS.

BPM



> > I'm trying to compare the execution times of two different queries on
the
> > same database.  Is there something in Query Analyzer or Enterprise
Manager
> > that can do this?

> I usually use SELECT getdate() in strategic places. Sometimes I might to


>    EXEC test_stuff


> Also, be sure to say DBCC DROPCLEANBUFFERS between the runs, else the
> 2nd versio can appear much faster, because the 1st version brought all
> data pages into cache from disk.

> --
> Erland Sommarskog, SQL Server MVP

> Books Online (updated!) for SQL 2000 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 
 
 

How to measure Store Procedure execution time?

Post by Erland Sommarsko » Wed, 10 Jul 2002 18:07:30



> It's a good idea to do a DBCC FREEPROCCACHE in addition to DBCC
> DROPCLEANBUFFERS.

Yes. I haven't done this lately, because I have only been testing
single SQL queries, but for the example I gave FREEPROCCACHE would
be required too, that's correct.

We should also add the word of warning that these two are maybe not so
good to run in a production environment, as they flush the cache. A
system that relies heavily on its cache would see a temporary performance
degradation if you issue these commands, as a lot of pages would have
to read from disk all at a sudden.

--
Erland Sommarskog, SQL Server MVP

Books Online (updated!) for SQL 2000 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp