Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help to get less reads from a query

Author  Topic 

hesta96
Starting Member

9 Posts

Posted - 2002-06-10 : 04:58:34
Hello.

I have a problem with a sql-query that is generating a lot of reads in the DB according to SQL-Profiler, but not acordning to "Set Statistics Time ON AND Set Statistics IO ON" and "show execution plan" in SQL Query Analyzer. In Profiler it says that it generate around 20000 reads and in Query Analyzer it says about 400 reads. Can anyone tell me why that is?? The question is a Stored Procedure and lookes like this:

Select pub.ID,txt.Title, pub.publishingstart,unit.SitePath
From Published as pub Inner Join Texts as txt
On pub.TextID = txt.ID Inner Join Rel_TextsKeywords as relkey
On txt.ID = relkey.TextID Inner Join Keywords as keyword
On relkey.KeyWordID = keyword.ID Inner Join Units as unit
On pub.UnitID = unit.ID
Where pub.Adjustable <> 2 AND pub.UnitID = 83 AND pub.Obj_type=1 AND keyword.ID = 5 AND pub.Active = 1 AND pub.publishingStart < getdate() AND pub.PublishingStop > getdate()
Order By pub.publishingstart desc

I have used Index Tuning Wizard to set the optimal index on the database and the two big tables Published and Texts have only about 74000 rows each.

Please help!
Sincerely
Henrik Stahle
SR

VyasKN
SQL Server MVP &amp; SQLTeam MVY

313 Posts

Posted - 2002-06-10 : 06:17:58
The following should help you understand what's going on:

INF: Differences in STATISTICS IO, SQL Profiler and Sysprocesses IO Counters (Q314648)
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314648

--
HTH,
Vyas
http://vyaskn.tripod.com
Go to Top of Page
   

- Advertisement -