>Hi,
>
>a system I have has a table called Transactions, then a view based on that called viewTransactions and then another view based on the first view called viewTopTransactions.
>
>Should I create indexes on the underlying table and that will speed up queries against the views? Or should I create indexes on the views? or should I index both table and views?
>
>The queries are like this:
>
>SELECT DISTINCT [PNRStatus] FROM [viewTransactions] ORDER BY [PNRStatus]
HI, Frank - you can create materialized indexes from views. I have an online article that talks about an example:
http://www.codemag.com/Article/1601051 (the first of the thirteen items). Go to the section called "Answer 1: Knowing the Differences Between Materialized Views and Standard Views"
One thing I would definitely avoid (as Naomi said) is creating views off of views. Once someone does that, it usually paves the way for views off views off views. These can impact performance and can be difficult to maintain.
When you say you want to view Top Transactions, what would the "top" be based on?
Also, can you post the structure of the Transactions table?