Subject Re: Index Selectivity
Author Svein Erling
--- In firebird-support@yahoogroups.com, Tim Ledgerwood wrote:
> At 12:07 PM 08/12/2003 +0000, you wrote:
>
> >Tim,
> >since some of your indexes contain quite a few duplicates, it may
> >be wise to add the PK to the end of these indexes. E.g. rather than
> >having
> >
> >CREATE INDEX IDX_LOGSTOCK ON LOG(STOCK)
> >
> >do
> >
> >CREATE INDEX IDX_LOGSTOCK ON LOG(STOCK, ID)
>
> Shouldn't I rather just delete the indexes?

Sure, that would normally be the best option. Though occationally an
index can be useful even when it has lots of duplicates (e.g. Arno's
example of a Boolean column), and in such situations it is good to add
the PK to the end of the index.

Set
- I support Firebird, I am a FirebirdSQL Foundation member.
- Join today at http://www.firebirdsql.org/ff/foundation