Subject Re: [firebird-support] what is better: Index on single column or index on multi column ?
Author Ann W. Harrison
On 12/21/2010 4:46 PM, Vander Clock Stephane wrote:
>
> what is better (with around 30 000 000 rows) :
>
> Create table TABLEA
> SERVER SMALLINT NOT NULL,
> volume SMALLINT NOT NULL,
> ID INTEGER NOT NULL,
> Key BIGINT NOT NULL
>
> Create index multicolumnindex on TABLEA(SERVER, Volume, ID, Key);
> or
> Create table TABLEA
> SERVER_VOLUME_ID_KEY VARCHAR(40) //will be something like
> 32-123-432-1287634-324938347437347347879
>
> Create index onecolumnindex on TABLEA(SERVER_VOLUME_ID_KEY);
>

Why carry around 40 bytes of stuff you don't need? Firebird
indexes on integers are fine, especially now that statistics
are kept on each segment rather than guessing that the first
segment will be about 1/3 as selective as the whole.

Good luck,

Ann