Subject RE: [firebird-support] TimeStamp Index Question
Author Sasha Matijasic
> I have a query that will be ordering a TimeStamp field descending. Is
> it
> generally a good idea to place a descending index on a field like that?
> I would
> assume that a Time Stamp would have fairly low selectivity, but I guess
> that
> would depend on how many records are being inserted consistently...?
>
> Thanks for input. The SQL is below for better understanding.
>

Selectivity is calculated as number of distinct values divided by number of rows in a table, which means the highest possible value is 1. If you set sale_depart_time on update or insert with current_timestamp, then the index will have excellent selectivity, very close to 1. If that's the case the index will very much help, just remember to create descending index (or both asc and desc if you order you query both ways).

Sasha