Subject | Re: [firebird-support] Query optimization - Why this plan ? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-03-15T18:36:13Z |
Hi Ann !
Ann W. Harrison wrote:
:-)
PLAN JOIN (JOIN (JOIN (E INDEX (AK_EMPRESA_NOME),C INDEX (PK_CLIENTE),LP
INDEX (PK_LISTAPRECO),S INDEX (PK_SEGMENTOMERCADO),V INDEX
(PK_VENDEDOR),ET INDEX (PK_EMPRESA),ED INDEX (PK_EMPRESA)),EN INDEX
(FK_EMPRESA_ENDERECO)),ES INDEX (PK_ESTADO))
But this won't work for me, I should put the restriction on the where
clause, since it is a view :-(
the real query is something like:
select * from vCliente where Nome = 'Alexandre'
The vCliente is the view created with the query I wrote on my original
message, this view could be filtered using fields of any of the involved
tables, the "where" clause is generated on the fly by my application.
I hope you got some hint of what is happening and the different choosen
plans if I put the restriction on the "where" or on the "join" clause.
--
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
Ann W. Harrison wrote:
>Alexander, out of curiosity, what happens if you put the e.nameThe good plan !
>restriction into the "on" clause of the first join?
>
> JOIN Cliente c
> ON (e.EmpresaId = c.EmpresaId
> and e.Nome = 'Alexandre Benson Smith')
>
>
>
>
:-)
PLAN JOIN (JOIN (JOIN (E INDEX (AK_EMPRESA_NOME),C INDEX (PK_CLIENTE),LP
INDEX (PK_LISTAPRECO),S INDEX (PK_SEGMENTOMERCADO),V INDEX
(PK_VENDEDOR),ET INDEX (PK_EMPRESA),ED INDEX (PK_EMPRESA)),EN INDEX
(FK_EMPRESA_ENDERECO)),ES INDEX (PK_ESTADO))
But this won't work for me, I should put the restriction on the where
clause, since it is a view :-(
the real query is something like:
select * from vCliente where Nome = 'Alexandre'
The vCliente is the view created with the query I wrote on my original
message, this view could be filtered using fields of any of the involved
tables, the "where" clause is generated on the fly by my application.
I hope you got some hint of what is happening and the different choosen
plans if I put the restriction on the "where" or on the "join" clause.
>Regards,thank you very much !
>
>
>Ann
>
>
>
>
--
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