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

Home -> Community -> Usenet -> c.d.o.server -> Re: select value within an interval

Re: select value within an interval

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 19 Apr 2006 09:33:25 -0700
Message-ID: <1145464400.975970@yasure.drizzle.com>


Vladimir.Usov_at_gmail.com wrote:
> Hi Daniel
> Well the goal is to create an efficient SQL :-) that requires minimum
> of consistent gets.
> I need to get a product type from range of products based on particular
> product id.
> It is like salary table in Oracle HR Demo Scheme that stores salary
> ranges and if I want to report to manager salary grade I have to select
> emp.salary between low_value and high_value.
> Any idea why Oracle reads the whole table or does index FFS if I use
> INDEX hint?
> Does Oracle have problem with such selects?
> Regards
> Vladimir

Oracle doesn't "have a problem" but you seem to be making the assumption that reading the whole table is a bad idea. Might be ... might not be. The optimizer, based on the information it has available, certainly thinks it is taking the lowest cost path. I don't see any history of this thread above so it is hard to be too specific but I would suggest two things:

  1. Explain Plan
  2. If you are going to hint "fully" hint as recommended by Jonathan Lewis.

Be sure that the information you are providing to the optimizer is what it needs to make a good decision.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Apr 19 2006 - 11:33:25 CDT

Original text of this message

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