Subject Re: So confused
Author Adam
--- In firebird-support@yahoogroups.com, "robert_difalco"
<rdifalco@t...> wrote:
> >
> > SELECT
> > v.ID, e.nodeID, e.ID, a.MD5
> > FROM Elems e
> > JOIN ENames n ON n.ID = e.nameID
> > JOIN EVers v
> > ON v.elementId = e.ID AND v.ID = e.lastVersionID
> > JOIN EAttribs a ON a.ID = v.attribsID
> > WHERE
> > e.nodeID = ? /* -9223372036853775797 */
>
>
> Oddly enough, this still does a NATURAL on "Enames n" for me.
> Hmmm...there is plenty of data in ENames to warrant the use of the
> Primary Key Index. And enames has one other index on it, basically
an
> index of the Digests of the display name -- it's a unique index.

Robert,

One thing I have just thought of, have you by accident created an
index on the PK field of enames? PKs and FKs automatically add an
index for you, and for some reason the optimiser can get very
confused if two identical indexes are available, and it makes the
worst possible decision (to use neither).

Adam