Subject Re: [firebird-support] Creating INDEXes on a VIEW
Author Martijn Tonies
Hi Brian,

> The big concern that we would have would be to ensure that any query made
> against a view (rather than a table) still return relatively quickly. On
> some of our tables, this requires careful indexing. Maybe we're not
> thinking properly and should just create a new VIEW that uses a different
> index if it is critical to return as quickly as possible from the query.
> Am I thinking correctly now?


You cannot control what indices are used by the query -
However, you should index your underlying tables properly,
so that at execution time, the database engine uses the
appropriate indices to execute your query as fast as possible.

This has nothing to do with the VIEW.

When you query a view (example):

select t.*, v.*
from table1 t join myview v on ( =
where = 'Martijn' and t.status = 4

And is a column from, let's say, EMPLOYEE table,
and you have an index on that column in the employee table,
the database engine will (depending on more factors of
course) use that index to search for rows where EMPLOYEE.
NAME = 'Martijn'.

With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions