Is it logical to have an index on a timestamp column?
648346Dec 2 2008 — edited Dec 3 2008Hi,
We have a table that basically stores all changes made by users on the application. As you can imagine, this is one of the biggest tables in our system.
The table contains columns like create_date, start_date and end_date (when this change starts and when it finishes) and so on.
I'm in charge of writing a cognos report, and the requirement is that, for a supplied start and end date, find all the records in this table where the create_date column is between the parameter start date and end date.
Problem is, the create_date table is not indexed, therefore literally killing my query and the report is always timing out due to a full table scan.
this create_date column is a timestamp, and based on my understanding, an index will perform better if the column chosen has less distinct values. If I choose this column for an index, then I believe the index will probably get the same size as the table itself.
please correct me if I'm wrong.
The other option I've got is to force the user to use another parameter in our report parameter page -besides the dates-. These parameters are not mandatory at the moment. Some of these parameters are indexed columns that will certainly make my query faster.
thanks