Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to search date ranges
On Mon, 28 Jan 2002 03:37:35 GMT, "Michael Gill News" <me_at_work.com>
wrote:
>If I understand you correctly, creating an index on (person_id, start_date)
>would be quite effective, eh?
>Would you explain what you mean by "leading table"? Are you referring to the
>order in the FROM clause?
>
>Many thanks
The order in the from clause is only relevant when the optimizer is
incapable to determine the driving table. By design the driving table
(the table being read first) is the table which will return the lowest
number of records.
If the optimizer can't determine the driving table, it will use the
tables in the from clause from left to right (cost based optimizer,
which you are using) or from right to left (rule based optimizer).
Using the cost based optimizer the order can be forced by using
select /*+ ordered */ .....
from ....
etc.
Hth
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address Received on Sun Jan 27 2002 - 23:44:51 CST