Subject | Re: Any available documentation on Plan Analyzer? |
---|---|
Author | Adam |
Post date | 2005-02-06T22:40:59Z |
Thanks Ann,
I make no excuses for the query. It was poorly written, but hindsight
is an unfair advantage. As I have said before, the query is generated
at runtime, which means we don't actually know what table will be
joined to what other table (ok, we do know it will be one of four),
but it can make things a bit tricky to figure out. :) I actually do
not blame the optimiser at all. If the query was written correctly,
then there would have been no problems, and if the query was analysed
using IBPlanalyzer or IBAdmin or something, then it would have been
painfully obvious that it was poorly designed.
Adam
--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@i...> wrote:
I make no excuses for the query. It was poorly written, but hindsight
is an unfair advantage. As I have said before, the query is generated
at runtime, which means we don't actually know what table will be
joined to what other table (ok, we do know it will be one of four),
but it can make things a bit tricky to figure out. :) I actually do
not blame the optimiser at all. If the query was written correctly,
then there would have been no problems, and if the query was analysed
using IBPlanalyzer or IBAdmin or something, then it would have been
painfully obvious that it was poorly designed.
Adam
--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@i...> wrote:
> Adam wrote:inner
>
> >
> > Nope, switching join order for the sake of switching join order
> > doesn't help your cause but we needed left joins rather than
> > joins.regardless
>
> Firebird will select an optimum join order for inner joins,
> of the order of elements in the FROM clause. However, outer joinscan't
> be reordered in general - one good reason to avoid them if possible.set is
>
> Your example:
>
> select *
> from A
> left join B (on something)
> where B.testfield = 1
>
> I guess the optimizer should recognize that if the entire result
> dependent on a non-null value for a field in B, the join isn'tactually
> an outer join - rows in A that do not have a matching B are notorder of
> retained. It could then make an intelligent decision about the
> A and B.probably
>
> Or possibly your query generator could do the same... That's
> easier than teaching it about table cardinality and indexselectivity.
>
>
> Regards,
>
>
> Ann