We have a peculiar situation with a particular query.
This query joins to a view which creates a PIVOT on some data.
Now we are finding at some times this query runs really slow (10 seconds). I havent got a handle on how to consistently reproduce it running slowly.
However, when it runs slow we can drop and recreate the View joined in the query and this will get the query running quickly again (< 1 second). Now this UPDATE VIEW does not change the actual schema of the view in any way.
I am confused. Any ideas as to what could be going on here?
What happens whilst recreating a view that could speed up the query?