Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Without performance...

Status
Not open for further replies.

MarcosMello

IS-IT--Management
Nov 6, 2008
1
0
0
BR
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.
 
Negative conditions are better avoided, while you alias the tables you do not seem to use them in the where clause.
Did you write this out as ANSI style.
I would recommended checking your join-strategy, aren't you using redundant joins anyway?

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top