Groups | Blog | Home
all groups > sql server (alternate) > october 2004 >

sql server (alternate) : Indexed Views Vs temp tables


ravirneni NO[at]SPAM trafficmp.com
10/6/2004 5:06:50 PM
With my understanding of indexed views and according to books I read
"indexed views" are supposed to perform much better than "temp tables"
(temp table having primary key and indexed view with clustered index
on the same keys).

But when I tried in my system I am getting opposite results. With
Indexed Views it takes 3 times more time.

Any body has any reasons for that? Or my understanding was wrong?


thanks
David Rawheiser
10/7/2004 12:53:23 AM
Indexed views are expensive when adding data, since adding to the base table
also has to update the view's indexes as well as the base table.

It only helps on the retrieve (and only if the index on the view is used in
the query plan).

I have only used them for lookup tables that rarely change.

[quoted text, click to view]


Dan Guzman
10/7/2004 2:27:29 AM
Temp tables and views are different animals. Like David mentioned, examine
the query plan to ensure the index on the view is actually being used.

--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]

AddThis Social Bookmark Button