Fórum Select Join muito lento !! #59616
01/04/2008
0
Preciso de uma ajuda..
Estou executando um select simples mas está demorando muito..
segue o código :
select PO0100.C_COD_EMPRESA, PO0100.C_COD_PROPOSTA, CA0100.C_COD_CLIENTE, CA0100.C_NOME_CLIENTE, CA0100.C_ENDERECO_CLIENTE from PO0100, CA0100 where PO0100.C_COD_CLIENTE n= CA0100.C_COD_CLIENTE and PO0100.C_COD_EMPRESA = ´001´ and PO0100.C_COD_EMPRESA = CA0100.C_COD_EMPRESA and UPPER(PO0100.C_COD_PROPOSTA) LIKE UPPER(´¬013/08¬´) order by PO0100.C_COD_PROPOSTA
Não sei porquê.. mas quando uso a empresa 008, funciona que é uma beleza..
Por quê tá lento ????
Agradeço a todos antecipadamente...[/code]
Cabelo
Curtir tópico
+ 0Posts
04/04/2008
Sremulador
Gostei + 0
05/04/2008
Emerson Nascimento
Gostei + 0
07/04/2008
Cabelo
As tabelas possuem assim :
PO0100 mais ou menos 5000 registros..
CA0100 mais ou menos 3000 registros..
Os índices das tabelas somente os com os campos de chave primária :
CA0100
C_COD_EMPRESA, C_COD_CLIENTE
PO0100
C_COD_EMPRESA, C_COD_PROPOSTA
estes índices foram incluídos automaticamente quando criei as chaves primárias..
Fiz o seguinte select e deu certo, mas não sei se está correto :
select PO0100.C_COD_EMPRESA, PO0100.C_COD_PROPOSTA, PO0100.C_COD_CLIENTE, CA0100.C_ENDERECO_CLIENTE, CA0100.C_NOME_CLIENTE from CA0100 right join PO0100 on (CA0100.C_COD_CLIENTE = PO0100.C_COD_CLIENTE and PO0100.C_COD_EMPRESA = CA0100.C_COD_EMPRESA) where PO0100.C_COD_EMPRESA = ´001´ and PO0100.C_COD_PROPOSTA LIKE UPPER(´¬13/08¬´) order by PO0100.C_COD_PROPOSTA
Funcionou uma beleza..
Mas me fala uma coisa.. está correto ????
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)