Subject Re: Indices and views
Author csswa
Hiya Christian. Thanks for sending me the full DDL.

I've been fussing over this for an hour now, turning it this way and
that. I build a mini version of your tables and view and have
reproduced the behaviour in that too.

Recapping, the LEFT JOIN plans show:

1 - PLAN JOIN (T1 ORDER RDB$PRIMARY8,T2 INDEX (RDB$PRIMARY11))
2 - PLAN JOIN (T1 NATURAL,T2 TEST1B NATURAL)

(1) table–table join
(2) table–view join

Same queries, but reverting the LEFT JOIN to a simple JOIN yields the
plans:

1 - same as above
2 - PLAN JOIN (T1 ORDER RDB$PRIMARY8,T2 TEST1B INDEX (RDB$PRIMARY11))

So it is the LEFT JOIN that's throwing off the index use in the TABLE-
VIEW join.

I'm in way over my head so I'm bowing out — but this needs to get
answered. Unless there is an obvious reason why the view cannot use
the underlying table's index in a LEFT JOIN, this could be a bug
candidate. Might be time to scour sourceforge to see if anyone has
logged this 'feature'.

Regards,
Andrew Ferguson
-- Come visit the world's first evil petting zoo.