I have a query that basically links together three Tables and a View which has started running extremely slowly... it used to be OK but is now tediously slow.
The View is simply a table separation - the table used contains a list of data each with an assigned "ID" of which multiple "ID" entries can exist with a different "Type" column value i.e. Count, Description, Cost. The table has an index which uses both fields. The View just selects ALL entries where the "Type" column value = "Count".
The three tables and the view are linked using LEFT OUTER JOINs on a common field from each table - which runs slow.
BUT if I remove the view and link directly to the table and apply the WHERE [Type]='Count' to the query it runs almost instantly...
My question is how/why is SQL treating the two differently? It's almost like the index from the table used in the view is not used - is this to be expected?
Any comments/help always welcomed.