MarcosMello
IS-IT--Management
I need to execute this query:
SELECT
E5_FILIAL,
E5_PREFIXO,
E5_TIPO,
E5_NATUREZ,
E5_DATA,
E1_VALOR,
E2_VALOR
FROM
SE5010 SE5,
SE1010 SE1,
SE2010 SE2
WHERE
SE5.D_E_L_E_T_ = ''
AND SE1.D_E_L_E_T_ = ''
AND SE2.D_E_L_E_T_ = ''
AND E5_FILIAL <> ''
AND E5_DATA > '20080801'
AND E5_SITUACA NOT IN ('X','C','E')
AND E5_TIPODOC NOT IN ('DC','JR','MT','ES')
AND ((E1_FILIAL = E5_FILIAL
AND E1_NUM = E5_DOCUMEN
AND E1_PREFIXO = E5_PREFIXO
AND E1_TIPO = E5_TIPO
AND E1_PARCELA = E5_PARCELA
AND E1_CLIENTE = E5_CLIFOR)
OR (E5_FILIAL = E2_FILIAL
AND E5_DOCUMEN = E2_NUM
AND E5_PREFIXO = E2_PREFIXO
AND E5_PARCELA = E2_PARCELA
AND E5_TIPO = E2_TIPO
AND E5_CLIFOR = E2_FORNECE))
But SE1 table have about 3.500.000 register;
SE2 about the same and SE5, about 5.500.000.
When I run that query, the DB I/O blows up!
Can anyone help with change the query to other way to catch performance? (DB tunneling).
Tks a lot.
SELECT
E5_FILIAL,
E5_PREFIXO,
E5_TIPO,
E5_NATUREZ,
E5_DATA,
E1_VALOR,
E2_VALOR
FROM
SE5010 SE5,
SE1010 SE1,
SE2010 SE2
WHERE
SE5.D_E_L_E_T_ = ''
AND SE1.D_E_L_E_T_ = ''
AND SE2.D_E_L_E_T_ = ''
AND E5_FILIAL <> ''
AND E5_DATA > '20080801'
AND E5_SITUACA NOT IN ('X','C','E')
AND E5_TIPODOC NOT IN ('DC','JR','MT','ES')
AND ((E1_FILIAL = E5_FILIAL
AND E1_NUM = E5_DOCUMEN
AND E1_PREFIXO = E5_PREFIXO
AND E1_TIPO = E5_TIPO
AND E1_PARCELA = E5_PARCELA
AND E1_CLIENTE = E5_CLIFOR)
OR (E5_FILIAL = E2_FILIAL
AND E5_DOCUMEN = E2_NUM
AND E5_PREFIXO = E2_PREFIXO
AND E5_PARCELA = E2_PARCELA
AND E5_TIPO = E2_TIPO
AND E5_CLIFOR = E2_FORNECE))
But SE1 table have about 3.500.000 register;
SE2 about the same and SE5, about 5.500.000.
When I run that query, the DB I/O blows up!
Can anyone help with change the query to other way to catch performance? (DB tunneling).
Tks a lot.