Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Indexed View

Author  Topic 

tsiegle
Starting Member

9 Posts

Posted - 2004-02-24 : 17:51:48
I am trying to decide how to best handle records we don't ever want to show on the front end and what we decided was to do an indexed view of the table, excluding the unwanted records. I am trying to decide if I should rename the table and give the new view the tables name "Customer" so that we don't have to change code and then I saw this in an article:

The indexed view can be used in a query execution in two ways. The query can reference the indexed view directly, or, more importantly, the query optimizer can select the view if it determines that substituting the view for some or all of the query is more efficient. In the second case, the indexed view is used instead of the underlying tables and their ordinary indexes. The view does not need to be referenced in the query for the query optimizer to use it during query execution. This allows existing applications to benefit from newly created indexed views without changing these applications.

Can anyone explain to me what I should do - is there a way to ensure that our applications will automatically use the view and not show the specified records?

Thanks!

Thanks!

Tracy Siegle

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-02-24 : 18:00:21
I have never used indexed views like this, but I would guess that you could tell if SQL Server is going to use the view instead of the table by looking at the execution plan in Query Analyzer.

Tara
Go to Top of Page
   

- Advertisement -