Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Slow running Query.

RE: Slow running Query.

From: Juan Carlos Reyes Pacheco <jreyes_at_dazasoftware.com>
Date: Tue, 22 Jun 2004 13:35:59 -0400
Message-Id: <40D86DFF.000007.02400@CACHITOSS>


Thanks Lex, you are right. good point for Kumar if this has some impact in his query.  

-------Original Message-------  

From: oracle-l_at_freelists.org
Date: 06/22/04 13:30:53
To: oracle-l_at_freelists.org
Subject: RE: Slow running Query.  

Juan,
in your case you don't even need the nvl function -- because the result is always 3.
the problem occurs with the empty set. check this out:  

SQL> create table blah(c1 number);
Table created.  

SQL> select nvl(sum(c1),0), sum(nvl(c1,0)) from blah;  

NVL(SUM(C1),0) SUM(NVL(C1,0))
-------------- --------------
0  

SQL>   Kind regards,
Lex.  



visit my website at http://www.naturaljoin.nl <http://www.naturaljoin.nl>
     

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Juan Carlos Reyes Pacheco
Sent: Tuesday, June 22, 2004 18:21
To: oracle-l_at_freelists.org
Subject: RE: Slow running Query.    

Hi Lex, why you say that, could you showme why please  

I show you why I say is the same:
SQL> select * from test;  

TEST



1  

2  

Transcurrido: 00:00:00.00
SQL> select count(*) from test where test is null;  

COUNT(*)



1  

Transcurrido: 00:00:00.00
SQL> select sum(nvl(test,0)) from test;  

SUM(NVL(TEST,0))



3  

Transcurrido: 00:00:00.00
SQL> select nvl(sum(test),0) from test;  

NVL(SUM(TEST),0)



3  

Transcurrido: 00:00:00.00    

-------Original Message-------  

From: oracle-l_at_freelists.org
Date: 06/22/04 12:43:39
To: oracle-l_at_freelists.org
Subject: RE: Slow running Query.  

Juan,  

unfortunately sum(nvl(column,0)) is not equivalent to nvl(sum(column),0)..  

Kind regards,
Lex.  



visit my website at http://www.naturaljoin.nl
   

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Juan Carlos Reyes Pacheco
Sent: Tuesday, June 22, 2004 17:15
To: oracle-l_at_freelists.org
Subject: RE: Slow running Query.    

Hi, I will do t he following    

Try creating function indexes on composed columns you are queryin and tellme if this improves something
For example you are using as_date in the where column, but you don't have a index on substr(ca_date,1,4,....  

Only to avoid unncesary plsql work
1. instead sum(nvl(column,0)) I'll use nvl(sum(column),0 2. instead of decode use case    


Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
 
 

-- Binary/unsupported file stripped by Ecartis --
-- Type: text/x-vcard
-- File: Lex de Haan.vcf
---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------
Received on Tue Jun 22 2004 - 12:36:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US