Home » RDBMS Server » Performance Tuning » Theoretical Question Regarding Full Table Scans
Theoretical Question Regarding Full Table Scans [message #142192] Thu, 13 October 2005 13:25 Go to next message
scottwmackey
Messages: 515
Registered: March 2005
Senior Member
I have a query similar to the following
SELECT /*+ ORDERED FULL(a) PARALLEL (a) FULL(b) PARALLEL (b) FULL(c) PARALLEL (c)  FULL(d) PARALLEL (d) */
       *
FROM   desc_a a,
       desc_b b,
       desc_c c,
       desc_d d,
       desc_e e,
       desc_f f,
       (SELECT /*+ FULL(m_in) PARALLEL (m_in) FULL (o) PARALLEL (o)*/
               m_in.*,
               o.expiration_dt,
               o.master_id o_master_id
        FROM   master m_in,
               option o 
        WHERE  m_in.master_id = o.master_id(+)
            ) m 
WHERE b.id(+) = a.id
AND   c.id(+) = a.id
AND   d.id(+) = a.id
AND   e.id(+) = a.id
AND   f.id(+) = a.id
AND   m.cip(+) = a.cip

Here's what I know to be always true. desc_a will have around 500K records. desc_b, c, d, e, and f will have as many or fewer, but never more than desc_a. id is unique for each table, thus all rows for all of these tables will be hit once and only once. master may contain about 10% more records than desc_a. For each run of the query, about 90% or more of the rows in master will be selected. option has approximately 25% of the rows that master has. For each query, all rows in option should be selected.

So here's my question, is there any reason I shouldn't be doing a full table scan on all of these tables and trying to convince Oracle to hash join them? I have analyzed the tables and the CBO still wants to join all of these by index and perform nested loops. Everything I have read regarding this says the slowest possible query is an index search that will hit every row. So, here's the kicker. When I let Oracle do what it want's, i.e. without hints, the query finishes about 4 minutes. When I add the hints to do what I thought was supposed to be fast, it doesn't seem to ever finish. Could this have anything to do with CPU (since hashes are CPU intensive) or RAM (maybe it's requiring virtual memory and doing a lot of swapping to and from disk). Could my results change dramatically, i.e. the full table scans become much faster than the index scans, when I move to a different box. Anybody have any experience with this or just some insights?

[Updated on: Thu, 13 October 2005 13:26]

Report message to a moderator

Re: Theoretical Question Regarding Full Table Scans [message #142203 is a reply to message #142192] Thu, 13 October 2005 15:24 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
Can we assume that your tables have a bunch of other columns that are being selected that are not indexed, so that oracle can't simply read the indexes and get the answer but it has to read the index and go hit the tables?

Does oracle (without hints) do a full scan of any of your tables? Not even desc_a and/or master?

Any partitions or bitmap indexes or anything else unusual?

Any difference if you have or don't have the parallel hint in combination with the full hints?

Perhaps it can scan those indexes and join them together quickly, which I would think is likely. Can we see the 2 plans?
Re: Theoretical Question Regarding Full Table Scans [message #142204 is a reply to message #142203] Thu, 13 October 2005 16:11 Go to previous messageGo to next message
scottwmackey
Messages: 515
Registered: March 2005
Senior Member
smartin,

I don't have time to explain everything wrong I was doing, but suffice it to say, your comments were critical in putting me back on the right track.

Thanks.
Re: Theoretical Question Regarding Full Table Scans [message #142207 is a reply to message #142192] Thu, 13 October 2005 16:55 Go to previous message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
Glad it could help, although I don't understand Smile

If there is something that we can learn from this, please post back whenever you have time. If not, have a good one.
Previous Topic: Why two sets of explain plans in tkprof..ed file??
Next Topic: Slow Query
Goto Forum:
  


Current Time: Thu Apr 25 22:15:37 CDT 2024