April 25, 2013 at 5:32 am
Hi all,
I optimized a query by replacing table valued function with LEFT JOIN, and managed to reduce the Scan Count and Logical Reads from 1500,12000 to 25,150.
But Query is still taking same time for execution. What could be the possible reason!!!
April 25, 2013 at 6:17 am
Could be anything, and without more information there's no way that anyone's going to be able to offer useful help.
To start with, what's the wait types the query gets? What's the query? What are the table definitions? What indexes do those table have? What does the execution plan look like? What's the CPU and duration? Are there still scalar functions (that don't count towards the logical reads displayed) and if so what are their definitions?
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
April 25, 2013 at 8:38 am
I have seen quite a few refactors addressing huge logical reads from nested loops on lots of rows (bad estimates usually the root cause) changed to scans and hashes taking equal or even longer total time due to the CPU hit (or tempdb hit) for the hashing.
As Gail said there are a LOT of things that could be in play here and you gave us essentially nothing to go on.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
April 25, 2013 at 11:17 am
As the others have said, it could be anything. They didn't list contention, so I'll toss that out there too.
Posting the query & structure along with an actual execution plan will get you more and better information.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply