on 07-08-2008 4:22 PM
Hi all, I have a view that I am reading from, but would like to know if I can create and index over that view and how?
Thanks
Mike
No, you cannot. Views do not store any data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To optimize a view you have to consider ...
1. Join condition fields, which of course the more selective and indexed the better.
2. The where condition used to select from the view.
Take a look at the fields used in the where statement and look at which table the field applies to. For example:
select * from view1 where field1 = x, field2 = y, field3 = x
-- view 1 composes of tables 1 and 2.
field 1 is in both tables.
field 2 is in table 1 only.
field 3 is in table 2 only.
Then, on table 1 you would want an index containing fields 1 and 2. On table 2 you would want index containing fields 1 and 3.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.