September 8, 2010 at 3:03 am
I have a database with millions of records contain NEWS, at this time I have about 800 online users who read data from database.Server CPU usage is fluctuating between 30 and 90 and all is allotted to "sqlservr.exe".I ran "Sql Profiler" at that time and checked the requests but i saw somethings strange, please see the picture :
as you can see in picture all request was done shortly except highlighted row that had "329 in CPU, 202 in Duration and 19204 Read"
I ran its query manually and i get the result rapidly !
I want you to tell me why this fluctuation happen?
September 8, 2010 at 3:14 am
Does that particular query always run with that many reads? (There's only one entry for it in the profiler trace)
It was running rapidly in the trace (200ms), so the fact that it ran fast manually says nothing.
Does it do the same number of reads when run manually?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 8, 2010 at 3:37 am
Does that particular query always run with that many reads? (There's only one entry for it in the profiler trace)
Does it do the same number of reads when run manually?
I have attached a new pic that i ran it manually ( its same as prior)
It was running rapidly in the trace (200ms), so the fact that it ran fast manually says nothing.
sorry, I made a mistake.
September 8, 2010 at 4:04 am
Ok, so it does always have a high reads. Looks like it needs optimising.
I'm not sure I fully understand what you're asking.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 8, 2010 at 4:15 am
I'm not sure I fully understand what you're asking.
I think the fluctuating CPU usage by sqlservr.exe, may cause for this heavy reads. how can i fix these?
September 8, 2010 at 4:27 am
Could be. You need to optimise this and other poorly-performing queries.
If you have no idea where to start, take a look at this 2-part series
If you'd like our help in optimising this, please post table definitions, index definitions and execution plan as per http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 8, 2010 at 5:38 am
If you'd like our help in optimising this, please post table definitions, index definitions and execution plan
my query is :
select top 1 [name],address,nextmedia1,[description] from media where look=1 and name ='100942885226.jpg' order by tdmedia
I have attached the table definition and execution plan in following file :
Thanks
September 8, 2010 at 5:45 am
No indexes whatsoever on the table?
If not, I'd venture a guess that the complete lack of indexes is the reason this query is not optimal.
I suggest that if the lack of indexes extends to other tables, you really need to do a performance tuning exercise on this DB.
For this query, try this index.
CREATE NONCLUSTERED INDEX idx_Media_NameLook ON [dbo].[media] ([name],[look])
p.s. You have a clustered index on a GUID. That's about the worst possible place for a clustered index.
Is this a vendor app or something developed in-house? If it's at all possible, move the clustered index onto the identity column you have and make the primary key nonclustered.
This clustered index is going to be causing massive fragmentation and it really won't be helping your performance issues.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply