Re: Query failing in CBO mode

2003-02-26 Thread Jonathan Lewis

All other things being equal (and there
are a couple of pages in the performance
tuning guide outlining some things that
are not equal - like joins conditions, indexed
columns, subqueries, user-defined functions
etc.) the 'final' predicates against a  single table
are evaluated from the bottom up under RBO and
from the top down under CBO.


Everything is subject to change, of course -
so if you are using cpu_costing in version 9
you may already have discovered that Oracle
will ignore the above and re-arrange the order
of the 'final' predicates against a single table
to minimise the CPU cost of evaluating them.

In your case it appears that the RBO eliminates
the problem rows because none of them get
through the last two predicates:
  PROJECT_ORDER = 'Y'
and ORDER_STATUS ='O'



Regards

Jonathan Lewis
http://www.jlcomp.demon.co.uk

Coming soon one-day tutorials:
Cost Based Optimisation
Trouble-shooting and Tuning
Indexing Strategies
(see http://www.jlcomp.demon.co.uk/tutorial.html )

UK___March 19th
USA_(FL)_May 2nd


Next Seminar dates:
(see http://www.jlcomp.demon.co.uk/seminar.html )

USA_(CA, TX)_August


The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


- Original Message -
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
Sent: 26 February 2003 05:18


 I have an application query that runs fine in RBO mode but failing
in CBO with ORA-01722: invalid number -

 select /*+ rule */ ORDER_NO,ITEM_NO
 from [EMAIL PROTECTED]
 where ORDER_NO = 4432089
 and PROJECT_ORDER = 'Y' and ORDER_STATUS ='O'

 ORDER_NO ITEM_NO
 -- 
 4432089 TOOLING COSTS

 1 row selected.

 select /*+ choose */ ORDER_NO,ITEM_NO
 from [EMAIL PROTECTED]
 where ORDER_NO = 4432089
 and PROJECT_ORDER = 'Y' and ORDER_STATUS ='O'

 ERROR:
 ORA-01722: invalid number
 ORA-02063: preceding line from DB01.WORLD

 no rows selected

 ORDER_NO column is varchar2 field and it may be containing some
non-numeric data, so I understand that Oracle may be doing implicit
conversion on order_no. But, then why it is working fine in RULE
based. The explain plan is same in both cases and is using FULL Table
access. The table has unique index on ORDER no.


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Jonathan Lewis
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: Query failing in CBO mode

2003-02-26 Thread Jamadagni, Rajendra
Title: RE: Query failing  in CBO mode 





Okay ... Rule Number 1.


Always convert the data type of the *variable value* to that of table column you are comparing with, and not the other way. The later part causes the problem.

Raj
-
Rajendra dot Jamadagni at espn dot com
Any views expressed here are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !!



-Original Message-
From: Anubha Jalsingh [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 26, 2003 12:19 AM
To: Multiple recipients of list ORACLE-L
Subject: Query failing in CBO mode 



[ --- ]
ORDER_NO column is varchar2 field and it may be containing some non-numeric data, so I understand that Oracle may be doing implicit conversion on order_no. But, then why it is working fine in RULE based. The explain plan is same in both cases and is using FULL Table access. The table has unique index on ORDER no.

Thanks in advance.
Manmohan



*This e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*1


Query failing in CBO mode

2003-02-25 Thread Anubha Jalsingh
I have an application query that runs fine in RBO mode but failing in CBO with 
ORA-01722: invalid number -

select /*+ rule */ ORDER_NO,ITEM_NO
from [EMAIL PROTECTED]
where ORDER_NO = 4432089
and PROJECT_ORDER = 'Y' and ORDER_STATUS ='O'

ORDER_NO ITEM_NO
-- 
4432089 TOOLING COSTS

1 row selected.

select /*+ choose */ ORDER_NO,ITEM_NO
from [EMAIL PROTECTED]
where ORDER_NO = 4432089
and PROJECT_ORDER = 'Y' and ORDER_STATUS ='O'

ERROR:
ORA-01722: invalid number
ORA-02063: preceding line from DB01.WORLD

no rows selected

ORDER_NO column is varchar2 field and it may be containing some non-numeric data, so I 
understand that Oracle may be doing implicit conversion on order_no. But, then why it 
is working fine in RULE based. The explain plan is same in both cases and is using 
FULL Table access. The table has unique index on ORDER no.

Thanks in advance.
Manmohan



_
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plusref=lmtplus
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Anubha Jalsingh
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).