Subject Re: Same Query - Dirrerent GDBs - Different Plan
Author rodbracher
>
> The information that would help is the selectivity numbers from
> rdb$indices for the tables involved.
>
Both stats checked after a restore/backup
GDB SLOW

PLAN SORT (JOIN (JOIN (JOIN (WAYBILL NATURAL,
ROUTING INDEX (RDB$PRIMARY58,RO_MANIFEST)),
PLACE INDEX (RDB$PRIMARY50)),CONTENTS INDEX (RDB$PRIMARY17)))

RDB$STATISTICS

Routing Table
RDB$PRIMARY58 = 1.276
RO_MANIFEST = 6.037

Waybill Table
RDB$PRIMARY67 = 1.972


GDB FAST

PLAN SORT (JOIN (JOIN (JOIN (ROUTING INDEX (RO_MANIFEST),
WAYBILL INDEX (RDB$PRIMARY67)),PLACE INDEX (RDB$PRIMARY50)),
CONTENTS INDEX (RDB$PRIMARY17)))

RDB$STATISTICS

Routing Table
RDB$PRIMARY58 = 5.608
RO_MANIFEST = 0.000127

Waybill Table
RDB$PRIMARY67 = 1.549

So clearly a big difference in the Primay and RO_MANIFEST between the
two GDBs

How is this selectivity used ?

And still the point is if I use the Plan of the fast table on the
slow table - it too becomes fast ( with the query mentioned ).

Rod