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: What's wrong with this query

Re: What's wrong with this query

From: Shevtsov, Eduard <EShevtsov_at_flagship.ru>
Date: Tue, 11 Sep 2001 16:54:20 -0700
Message-ID: <F001.0038A68D.20010911110526@fatcity.com>

Hi Anne,

what's the reason to use in the WHERE clause the following condition:

d.document_number = m.document_number

I didn't notice 'm' in SELECT part of the query and in FROM clause among other conditions.

> select /*+ INDEX(b)*/ distinct d.batch_number
> , d.document_number
> , d.entry_user_id
> , d.document_type_id
> , d.document_processed_date
> , b.batch_media_id, d.return_Method_Id
> from submitter_batch b , document d
> , ucc_master_amendment m
> where d.batch_number = b.batch_number
> and d.document_number = m.document_number
> and d.imaged = 0
> and b.batch_media_id = 4
> and d.document_status_id = 4

Yes, expected rows means 'cardinality'. These values are not always exact numbers. They are CBO's estimates only. Check if you have an index on b.batch_media_id How many distinct values does this column have? If the column has good selectivity you may want to have a B*Tree for it If your table is not being updated very often and the column has low selectivity you can consider to use Bitmap index.

BTW 4people who like puzzles.
I've described a case when CBO makes a mistake. http://www.oradba.com.ru/tuning/optimizer/articles/a1_cbomistake.shtml The page was written in Russian however it has enough information (excerpts from SQL*Plus output) to track my logic.

Regards,
Ed

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Shevtsov, Eduard
  INET: EShevtsov_at_flagship.ru

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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 Tue Sep 11 2001 - 18:54:20 CDT

Original text of this message

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