I am running the latest SQL Server 2008. We have been running our intranet site against this SQL database for 10 years and have never had performance problems. The database size is relatively small 8 gig. Recently I observed all our initial hits to the database have become very slow. Initial meaning before SQL starts caching each unique request. After the cache they are ultra fast again which means I can safely rule out the web rendering since we don't cache any pages. Pre cache queries use to take around 400ms and now as high as 3 sec. I do run the standard SQL maintenance weekly. I have examined the execution plans and everything is optimised. No scans. All seeks on indexes.
I have noticed something peculiar though. We have several views that are nested so the execution graph can get very deep in some situations. To see if the nesting is the problem I narowed the scope of the selected fields to eliminate some of the nested views from being included in the execution plan. To my surprize the performance did not increase. For example take a simple select like this:
SELECT ID FROM View1 WHERE ID = 1
This was not much faster than if I had selected all the fields from the View which would have included the entire nested list of other views into the execution plan contained. I then tried selecting directly from the table that View1 was selecting from:
SELECT ID FROM Table1 WHERE ID = 1
Even through the execution plans looked identical, selecting directly from the table was way faster reminescent to the performance we have been use to.
We have never experienced such overhead from Views as compared to direct table selects with identical execution plans. Is there some kind of maintenance I should be doing to prevent this degradation?
I don't know if I'm going down the wrong road here but I can't seem to find what is causing the slowdown.