This excerpt is from Tom Kyte's new book Expert Oracle Database Architecture: 9i and 10g Programming Techniques and Solutions, published by Apress in September 2005. Tom Kyte is Vice President of the Core Technologies Group at Oracle and has been using Oracle since 1988. For more frequently asked questions and myths about Oracle indexes, click here.
Do indexes work on views?
A related question is, "How can I index a view?" Well, the fact is that a view is nothing more
than a stored query. Oracle will replace the text of the query that accesses the view with the
view definition itself. Views are for the convenience of the end user or programmer -- the optimizer
works with the query against the base tables. Any and all indexes that could have been
used if the query had been written against the base tables will be considered when you use the
view. To "index a view," you simply index the base tables.
To see other frequently asked questions and myths about indexes, click here.