Subject | Re: [IBO] Slow select... |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-07-27T08:48:14Z |
Rejane,
Unlike STARTING WITH, LIKE can never use an index, so this query can only
benefit from two indexes: The most important being an index on
bairro.bai_codigo, and the other cep.cep_cidade.
you included cep_endereco in your where-clause or not. That is, it could be
considerably faster to return the first record (if only a few records have
ABACATE), but returning the entire result set should not be faster by
leaving out cep_endereco.
Set
Unlike STARTING WITH, LIKE can never use an index, so this query can only
benefit from two indexes: The most important being an index on
bairro.bai_codigo, and the other cep.cep_cidade.
>I'm with a problem in this Select:What do you mean by this? The query should be approximately as fast whether
>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!
you included cep_endereco in your where-clause or not. That is, it could be
considerably faster to return the first record (if only a few records have
ABACATE), but returning the entire result set should not be faster by
leaving out cep_endereco.
Set