Re: select value within an interval



Vladimir.Usov@xxxxxxxxx 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@xxxxxxxxxxxxxxxx
(replace x with u to respond)
.



Relevant Pages

  • Re: Why Statistics doesnt match reponse time?
    ... > four patches since then that have substantially improved the optimizer. ... Patches would not help him here. ... His hint causes the optimizer to do the ... As for the Oracle 9.2.0.6, the latest version, the optimizer was improved, ...
    (comp.databases.oracle.server)
  • Re: Oracle Hint Behavior
    ... Oracle would treat them as only "suggestions" but I thought in 10g they ... like to be able to explain why the hint is being ignored now. ... There is an interesting way to influence the optimizer without the use ... of DEC Rdb right after Oracle acquired Rdb back in '94/'95 timeframe. ...
    (comp.databases.oracle.server)
  • Re: Oracle Hint Behavior
    ... Oracle would treat them as only "suggestions" but I thought in 10g they ... like to be able to explain why the hint is being ignored now. ... There is an interesting way to influence the optimizer without the use ... of DEC Rdb right after Oracle acquired Rdb back in '94/'95 timeframe. ...
    (comp.databases.oracle.server)
  • Re: Oracle Hint Behavior
    ... Oracle would treat them as only "suggestions" but I thought in 10g they ... like to be able to explain why the hint is being ignored now. ... optimizer to use a particular index no matter how hard we tried. ... of DEC Rdb right after Oracle acquired Rdb back in '94/'95 timeframe. ...
    (comp.databases.oracle.server)
  • Re: Oracle Optmizer does not use the right index (Oracle 9.2.0.6)
    ... The fact remains that in the situation I have described, the Oracle ... Optimizer loses track of the first of the indexes (depending on the ... Hinted, with only the table name/alias, both indexes in place, T2_IND1 ... Oracle to guide the execution plan so that it does not prematurely ...
    (comp.databases.oracle.server)