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

Home -> Community -> Mailing Lists -> Oracle-L -> Need to customize execution plan for a cross table.

Need to customize execution plan for a cross table.

From: Mohammed Shakir <mshakir08816_at_yahoo.com>
Date: Mon, 25 Nov 2002 07:05:06 -0800
Message-ID: <F001.0050AAFF.20021125070506@fatcity.com>

I have a cross table that connects data in two base tables. If base table 1 is the driving table, query execution time is 0.02 seconds. If base table 2 is the driving table, query execution time is 0.5 seconds. But when this query is executed 10K times, it addes 1.5 hours to the processing time.

Execution plan is simple when base table 1 is the driving table. It is based on nested loop. First select data from table 1. Based on data selected from table 1, select data from cross table using nested loop. Do the same for base table 2. Cross table allows very quick data selection from base table 2. Oracle does a good job at it.

When base table 2 is the driving table, execution plan changes drastically. Now it uses sort-merge and merge join cartesian. Rather than cross table used to quickly get data from the next base table, it is used last.

So first select the data from base table 2. Then get all the records from base table 1 and sort - merge it with table 1. Now do nested loop join between this data and cross table data.

Since either of the two base tables can be a driving table, the only way I found is that I should create two separate queries, use ordered and nested_loop hints and this should work. However, the query is a view and therefore, I need to look into other possibilities.

Any ideas?

I am using oracle 8i(64 bits)(81.7.4) on Solaris(2.8). Also using cost based optimizer.



Mohammed Shakir
CompuSoft, Inc.
11 Heather Way
East Brunswick, NJ 08816-2825
(732) 672-0464 (Cell)
(732) 257-6001 (Home)


Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mohammed Shakir
  INET: mshakir08816_at_yahoo.com

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: ListGuru_at_fatcity.com (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).
Received on Mon Nov 25 2002 - 09:05:06 CST

Original text of this message

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