Please disregard - from your 10053, seems every access is using a unique index scan... Is dbms_advanced_rewrite.declare_rewrite_equivalence case sensitive or white space sensitive? -----Original Message----- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of ramick Sent: Monday, July 10, 2006 3:03 PM To: Brandon.Allen@xxxxxxxxxxx; 'Alex Gorbachev' Cc: oracle-l@xxxxxxxxxxxxx Subject: RE: Pinning/keeping plans in shared pool - using dbms_advanced_rewrite with query > 2499 characters How about using one of the old tricks to force a different plan like col+0 or col || `` on some column where there is not already an index used? This should make the SQL different... -----Original Message----- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] Sent: Monday, July 10, 2006 1:32 PM To: Alex Gorbachev Cc: oracle-l@xxxxxxxxxxxxx Subject: RE: Pinning/keeping plans in shared pool - using dbms_advanced_rewrite with query > 2499 characters Okay, I found a problem around that - I broke it up into smaller chunks and concatenated them together, e.g.: begin dbms_advanced_rewrite.declare_rewrite_equivalence( name => 'my_query', source_stmt => 'select blah blah blah' || 'from blah blah blah', destination_stmt => 'select /*+ RULE */ blah blah blah' || 'from blah blah blah', validate => false rewrite_mode => 'GENERAL'); end; But, now I'm getting the following error: ORA-30394: source statement identical to the destination statement Apparently it ignores differences in hints/comments because I added a RULE hint to the second query. So, I'll have to make some other modification in order for it to accept my query rewrite and try again. A few other things to note: 1) I made a typo in my previous email - the procedure is "declare_*rewrite*_equivalence" not declare_query_equivalence. 2) There is a documentation bug on this - it says that the 4th argument to the procedure is "mode", but it is actually "rewrite_mode" Regards, Brandon -----Original Message----- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Allen, Brandon Sent: Monday, July 10, 2006 1:10 PM To: Alex Gorbachev Cc: oracle-l@xxxxxxxxxxxxx Subject: RE: Pinning/keeping plans in shared pool - using dbms_advanced_rewrite with query > 2499 characters I'm trying to use dbms_advanced_rewrite.declare_query_equivalence, but getting error "SP2-0027: Input is too long (> 2499 characters)" because the query is about 6000 characters. Anyone know of a way around this? Thanks, Brandon -----Original Message----- From: Alex Gorbachev [mailto:gorbyx@xxxxxxxxx] Sent: Saturday, July 08, 2006 12:06 AM To: Allen, Brandon Cc: oracle-l@xxxxxxxxxxxxx Subject: Re: Pinning/keeping plans in shared pool I just though that it might be useful to check on DBMS_ADVANCED_REWRITE package and see if you can use it to incorporate certain hints that can make parsing fast. Privileged/Confidential Information may be contained in this message or attachments hereto. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. -- //www.freelists.org/webpage/oracle-l -- //www.freelists.org/webpage/oracle-l -- //www.freelists.org/webpage/oracle-l -- //www.freelists.org/webpage/oracle-l