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: Pinning/keeping plans in shared pool - using dbms_advanced_rewrite with query > 2499 characters

RE: Pinning/keeping plans in shared pool - using dbms_advanced_rewrite with query > 2499 characters

From: ramick <ramick_at_dotster.com>
Date: Mon, 10 Jul 2006 15:02:30 -0700
Message-Id: <20060710220238.D57223955CF@turing.freelists.org>


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_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] Sent: Monday, July 10, 2006 1:32 PM
To: Alex Gorbachev
Cc: oracle-l_at_freelists.org
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_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Allen, Brandon Sent: Monday, July 10, 2006 1:10 PM
To: Alex Gorbachev
Cc: oracle-l_at_freelists.org
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_at_gmail.com] Sent: Saturday, July 08, 2006 12:06 AM
To: Allen, Brandon
Cc: oracle-l_at_freelists.org
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.

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l

--

http://www.freelists.org/webpage/oracle-l Received on Mon Jul 10 2006 - 17:02:30 CDT

Original text of this message

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