Query Performance - HELP

Asked

Viewed 48 times

0

I’m making a query, but I am learning now. There is a way to improve the performance of this query?

select a.COD_EMPRESA, b.Dat_pagamento
from SAS_EMPRESA a
full outer join SAS_ITEM_PAGO b on (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)
Where a.COD_GRUPO= 'BOT1' and
TO_CHAR(b.Dat_pagamento,'YYYYMM') BETWEEN 201601 AND 201711
  • you know the prq is using the full Outer Join ?

  • and what he wanted to do with (a. COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)

  • TROQUE (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA) POR (a.COD_PREF_EMPRESA = b.COD_PREF_EMPRESA AND a.COD_EMPRESA = b.COD_EMPRESA)
Where a.COD_GRUPO= 'BOT1' and

  • @Marconciliosouza I don’t know why I’m using this command, I searched the internet, and I did some tests, this is what returned the data I need.

  • @Marconciliosouza the code looks like this: select a., b.
from SAS_EMPRESA 
full outer join SAS_ITEM_PAGO b on (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)
where a.COD_GRUPO = 'BOT1' and 
TO_CHAR(b.Dat_pagamento,'YYYYMM') BETWEEN 201601 AND 201711

São duas tabelas GRANDES. In the companies have the data and in the item_pago the codes. I will return Codes and Data, in a given period. The company code is separated into two fields: COD_PREF and COD_EMPRESA, you need to find company with the combination of the two fields. You can improve the performance of this query?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.