Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index View or Table?
Message
From
10/03/2016 16:13:05
 
 
To
10/03/2016 06:46:41
General information
Forum:
Microsoft SQL Server
Category:
Indexing
Environment versions
SQL Server:
SQL Server 2008 R2
Miscellaneous
Thread ID:
01632781
Message ID:
01632812
Views:
32
>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform