Showing posts with label oracle create outline. Show all posts
Showing posts with label oracle create outline. Show all posts

Monday, March 09, 2009

Create outline knowing needed hint

Let's assume you have a query with suffer performance problems. You worked out what hint may help, but you cannot apply hint to query as it is genereted by application. In case of simple hints, you can do this updating ol$hint table (in private outline). However sometimes it is not simple to know what updates needs to be done. This is simple way of doing this:

1. Identify query

2. CREATE OR REPLACE OUTLINE ORIGINALSQL ON

/

3. CREATE OR REPLACE OUTLINE HINTSQL ON

/

4. UPDATE OUTLN.OL$HINTS
SET OL_NAME=DECODE(OL_NAME,'HINTSQL','ORIGINALSQL','ORIGINALSQL','HINTSQL')
WHERE OL_NAME IN ('ORIGINALSQL','HINTSQL')
/

5. commit
/

6. DROP OUTLINE HINTSQL
/

7. alter outline ORIGINALSQL rename to
/