Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Can SQL Views be indexed?

I'm new to SQL on the iSeries -- being an old school programmer -- so this may seem like a dumb question. Traditionally, we can create a logical file that does not only select, but indexes. How can I do this in SQL? If I create a view with selection criteria, can I index it? I don't believe I can create an index with selection criteria.
SQL Views cannot be indexed -- this is defined in the SQL standard. With SQL you create your Views and then create indexes over the tables referenced by the View. Then when your database requests access the SQL View, it's the query optimizer's job to find an index to use when accessing your data through the specified SQL View.

You might want to read the Indexing strategies for DB2 UDB for iSeries white paper for more details on how the query optimizer utilizes indexes.


Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: tips, tutorials and more.

Check out this Search400.com Featured Topic: Database issues resolved

Dig Deeper on DB2 UDB (universal databases)