Subject Indexing views
Author Sasa Mihajlovic
Hi,

I have two tables (for sample master and detail table) which is
connected by FK.

master table
id integer
name varchar
desc varchar

detail table
id integer
mas_id integer
name varchar
qty integer

those two tables are create view

create view sample (id, mas_name, det_name, count_qty)
as select m.id, m.name, d.name, sum(qty)
from master m
left outer join detail d on d.mas_id = m.id
group by m.id, m.name, d.name

(I'm using LEFT OUTER JOIN, because someone can create master record
and if no record form detail are not attached via FK firebird will
ignore that master record from view)

So, is there some solution to create index on view or master and
detail table which will be used by view or how to speed up this
sample if I have 50000 master records and 800000 detail records.

Thanks in advance!