Subject Re: [firebird-support] Optimal plans using views
Author Milan Babuskov
kokok_kokok wrote:
> I have found that FB 2.0 does not get a good plan when I use some
> views. It does not use index in some scenarios, just natural queries.
> Then, if I rewrite the SQL using the underlying view sql statement, FB
> get the optimal plan. It seems than the View "hides" the index in some
> scenarios.
> Does somebody have a similar problem?

If you have views (esp. with unions) they would use the index with WHERE
clause, but not with JOIN. I usually work around this by rewritting the
query to use CTE or a subselect so it uses WHERE directly against the view.

Milan Babuskov