Subject Re: [firebird-support] Re: Query otimization - Why this plan ?
Author Alexandre Benson Smith
Hi Set !

Svein Erling Tysvær wrote:

>Hi Alexandre!
>
>
>I don't know, maybe Arno can tell you.
>
>
:-)

>Oh, sure, I always have plenty of ideas. Like you, I don't understand
>why the optimizer chose the plan it did - other than knowing InterBase
>often made a worse choice than the very best when there was a lot of
>tables to be joined and also wasn't as good with outer joins as with
>inner joins. The crazy changes I would recommend you to try, are
>either
>
>left join Endereco en on (en.EmpresaID = c.EmpresaID+0) ...
>
>
Same plan :-(

>(it shouldn't help any, but Firebird seems confused and maybe it makes
>it less tempting to use the index it currently uses)
>
>or to experiment with parenthesis, e.g.
>
>select * from (Empresa e
>join Cliente c on e.EmpresaId = c.EmpresaId)
>join SegmentoMercado s on s.SegmentoMercadoId = c.SegmentoMercadoId
>...
>
>
same plan :-(

>or
>
>select * from Empresa e
>join Cliente (c on e.EmpresaId = c.EmpresaId
>join ListaPreco lp on lp.ListaPrecoId = c.ListaPrecoId + 0)
>join SegmentoMercado s on s.SegmentoMercadoId = c.SegmentoMercadoId
>...
>
>
error :-((

>As you can see, I'm pretty confused as to where to put the parenthesis
>(I have never had to do this). Hence, it would be interesting to see
>the result if you find parenthesis any help.
>
>
>
I never had used parenthesis to especify the join order either, and even
don't know where to put it, I tried on some places but just got errors
("Token unknown line 2 char 17 - on", and some variations of it), the
only place where it works was if I tried the first query with
parenthesis that you suggested.

>HTH,
>Set
>
>
thank you very much for your help !

--

Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005