Re: Emptying the buffers
From: Jonathan Derbyshire (jonathan.derbyshire_at_student.shu.ac.uk)
Date: 03/22/04
- Next message: Peter Newman: "AutoNumber ?"
- Previous message: Peter: "N' in queries"
- In reply to: oj: "Re: Emptying the buffers"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Mar 2004 03:51:06 -0800
Hi,
Thanks for the loop, I like it. However.....is it possible to run the Stored Proc without actually returning the results in query analyser?
All I would like to see is the 2 select statemens from the @tb table.
Thanks
JD
oj wrote:
Here is an example for you:
e.g.
use Northwind
go
declare @tb table (run int identity primary key, duration int)
declare @dt datetime, @i int,@db int
set @i=10
set @db=db_id()
while @i>0
begin
checkpoint
dbcc dropcleanbuffers
dbcc flushprocindb(@db)
set @dt=getdate()
exec CustOrderHist 'VINET'
insert @tb
select datediff(ms,@dt,getdate())
set @i=@i-1
end
select * from @tb
select 'Average (ms)'=avg(duration),'Total (ms)'=sum(duration)
from @tb
go
-- -oj http://www.rac4sql.net "Jonathan Derbyshire" <jonathan.derbyshire@student.shu.ac.uk> wrote in message news:70070B23-72A4-4642-820C-CBA3D6FDEC8C@microsoft.com... > Hi, >> I'm working on a project to optimise the retrieval of data via Stored Procedures. >> I intend to run a particalur SP 10 times in a row to calculate the mean running time. >> However, i am aware that the SP will make use of the buffers after the initial execution. >> I need to test the average time of the query being run for the first time.... >> Will the command 'DBCC DROPCLEANBUFFERS' achieve what I need? >> What does the command 'WITH RECOMPILE' do?? Will I need this also??? >> Thanks >> JD
- Next message: Peter Newman: "AutoNumber ?"
- Previous message: Peter: "N' in queries"
- In reply to: oj: "Re: Emptying the buffers"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|