August 8, 2011 at 10:00 pm
Im selecting top1000 rows of a table but it takes very long time.can anybody suggest whats going on please
August 8, 2011 at 11:54 pm
clarification (8/8/2011)
Im selecting top1000 rows of a table but it takes very long time.can anybody suggest whats going on please
How long will it take to return the result?
top 1000 is very tiny one it'll not take time.
I suggest you to check is there any lock going on.
If you want use nolock hint.
Muthukkumaran Kaliyamoorthy
https://www.sqlserverblogforum.com/
August 8, 2011 at 11:57 pm
even though it takes long time
August 9, 2011 at 5:21 am
Without seeing the query and the execution plan, it's hard to tell you why it's taking a long time.
One point worth noting, when you tell it to return the TOP 1000 rows from a query, it still processes all the rows, it only returns to you the TOP 1000. That might be the entire explanation right there.
But, look at the execution plan for the query, figure out what it's doing and that should help you understand why things are running slowly.
"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
August 9, 2011 at 1:00 pm
Is it a simple select query or do it contain joins?
how much data is there in the table from which you are trying to retrive 1000 rows?
Is "where" or "order by" clause used in the query?
If possible please share the query and execution plan.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply