views:

15

answers:

2

Hello Experts,

I have a sql(2005) view which is running very very slow its takes 5 mins to run. But when i rip out the query from view and run it naked it hardly takes 5-6 seconds.

Can some one please advise me on how i can check what's going wrong with the view

Thanks Amit

A: 

As a first step I would ensure your statistics are up to date:

exec sp_updatestats 

or use UPDATE STATISTICS which is what exec sp_updatestats calls under the covers (with ALL parameter).

If that doesn't help, then examine the query plans for differences.

Mitch Wheat
thanks for the reply i did the "exec sp_updatestats" but its still running very slow.
Amit
A: 

Creating a clustered index on the view will definitely improve the performance.

http://www.sql-server-performance.com/tips/indexed_views_p1.aspx

Ranjeeth