Subject Re: [IBO] Slow select...
Author hans@hoogstraat.ca
Is it possible to create an extra field in your table 'cep' say 'ABACATE
shortint or char' and set this field to 'T' or 'F' or 0 or 1 on a insert
and update trigger for 'CEP', whenever 'cep-endereco' contains
'ABACATE'.
Nnw,
> from cep c
> where cep_cidade = 124
> and cep_endereco like '%ABACATE%'
becomes
> from cep c
> where cep_cidade = 124
> and endereco = 'T'

an index on (dep_cidade,enereco,...) should really help to speed up
the query.

-----------------------------------------------------------------

rejanem@... wrote:
>
> Hello,
>
> I'm with a problem in this Select:
>
> select c.cep_codigo,
> c.cep_cep8,
> c.cep_endereco,
> c.cep_endereco_tipo,
> c.cep_complemento,
> c.cep_cidade,
> c.cep_bairro,
> (select b.bai_nome from bairro b where
> b.bai_codigo=c.cep_bairro) as bairro
> from cep c
> where cep_cidade = 124
> and cep_endereco like '%ABACATE%'
>
> It's very slow, my table has 576.380 registries.
>
> But if I use the same sql without the operator 'like',
> the sql is fast!
>
> Is there another way that I can filter the
> field 'cep_endereco' without using the operator 'like'
> that return me the result highest?
>
> Thanks
>
> Rejane
>
>
> __________________________________________________________________________
> Acesso pelo menor preço do mercado! R$ 14,90 nos 3 primeiros meses!
> ASSINE AGORA! http://www.bol.com.br/acessobol/
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/