Subject Re: [firebird-support] Primary Keys / Indexes
Author Sándor Tamás (HostWare Kft.)
Usually FB tries to find indexes based on fields used in WHERE clauses width
AND. If they are ORed, the optimizer won't look for indexes on these fields.
You can force FB to use other indexes than it finds with the PLAN keyword,
like this:

select *
from table1 t1 join table2 t2 on t1.PId = t2.FKey
where t1.Adate = :I_date
plan join (t1 index (INDEX01), t2 index (INDEXT202))

This statement will try to use INDEX01 and INDEXT202 for optimizing the
select. Of course, if these indexes contains fields are can't be used for
this select, the statement will generate an error.

Most of the time the inner optimizer will do the works.

SanTa

----- Original Message -----
From: "volhoop" <mhoop81@...>
To: <firebird-support@yahoogroups.com>
Sent: Wednesday, February 22, 2006 4:43 PM
Subject: [firebird-support] Primary Keys / Indexes


> My understanding of how Firebird uses Primary keys and indexes are below.
> If there is a Primary Key or Index available, the Optimizer will use it.
>
> I come from an AS400 environment. The programmer chooses the index
> (logical) to be used not the database. How does the optimizer choose,
> and what types of problems arise from that situation? Can I choose
> the index to be used rather than the optimizer?
>
> MIKE
>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>