Subject Re: [firebird-support] Creating INDEXes on a VIEW
Author unordained
as i recall, 'order by' isn't allowed on a view? views exist mostly to make your sql simpler, by
putting common constraints and joins into the view rather than your sql ... but the final sql run
against the database is based on the combination of the two. you can't define an index on a view,
because a view doesn't contain data. it's meta-data. whatever indexes are available on the base
tables will be used (as the optimizer finds appropriate) in your queries that run against the view.
firebird views aren't "materialized views" like those that oracle makes available.

-philip

> Greetings, all:
>
> In an attempt to clean up a legacy database, we've been looking at revamping
> some of the tables and using views (the database with which we're working
> currently does not use views at all). A coworker had a question that I
> couldn't answer: Is it legal to define an index on a view? Or, is the
> thought that you should just 1) use an ORDER BY clause in the view
> definition, and 2) define a new view for each different way of collating the
> information required by the view?
>
> Thanks in advance for any asstance,
>
> Brian