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 2008 Forums
 Transact-SQL (2008)
 Slow view

Author  Topic 

Riklinssen
Starting Member

20 Posts

Posted - 2010-09-14 : 06:05:14
I have a view that combines 4 tables and as a result gets around 85000 records and 42 columns. All these columns are necessary.
The view worked perfect for several months but since a few days it's very slow (above 2 minutes). The design isn't changed and the input tables didn't grow much.
To find out what takes most time I viewed de execution plan and 70% is used for sorting the input. I don't understand this because in my view there is no sorting...
Can someone please explain why this sorting is done and if it's possible to prevent this from happening and so make my view work faster.

Kristen
Test

22859 Posts

Posted - 2010-09-14 : 06:15:14
A UNION or GROUP BY would require a sort - if you have one?

If data volume has not changed much maybe there has been no Index Rebuild recently? Or no recent Update Statistics?

Or some twit has used SHRINK on the database

Or something else on the server is stressing the CPU.

Or some other hardware issue - disks are doing lots of retries, or a Zombie is sending all the Nigerian SPAM
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-09-14 : 06:24:44
Or the data has become to fragmented.


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page
   

- Advertisement -