July 18, 2008 at 1:40 pm
I just created an indexed view that selects certain columns from 3 tables joined together, returning about 2200 rows. After I create my view and then my clustered index and some nonclustered indexes on the view, I verify that sp_spaceused 'myview' does, in fact, tell me that the view is using space.
Now, I expected that when I select anything from the view, the execution plan would show that SQL Server was reading data from the indexes on the view. However, when I run a query against the view and look at the graphical execution plan in Query Analyzer, it appears the DB engine is still running the SELECT statement underlying my view and performing all those joins again on the fly.
Is this a bug? Or have I totally missed something?
Thanks!
July 18, 2008 at 1:47 pm
I just discovered that using the NOEXPAND hint on the view makes this work as I expected. Is this always a requirement? (It would be news to me if so!)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply