Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is it logical to have an index on a timestamp column?

648346Dec 2 2008 — edited Dec 3 2008
Hi,

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
This post has been answered by JustinCave on Dec 2 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 31 2008
Added on Dec 2 2008
5 comments
4,341 views