Gossamer Forum
Home : General : Databases and SQL :

optimizing timestamp indexes in MySQL

Quote Reply
optimizing timestamp indexes in MySQL
Hi,

I've got a MySQL table that uses a timestamp column, which is indexed. I need to run frequent queries on this table based on rows with a timestamp above a certain value. For some reason, MySQL refuses to use the timestamp index and insists on doing a full table scan every time. It's a large table, so this is quite resource intensive. Since it only needs a very small percentage of the actual records (those which were added within the last 8 hours, typically), it seems like the query would run much faster if it used that timestamp index. Nonetheless, even when specifying that it should do so with "USE INDEX (timestamp_col)" MySQL still does a full table scan.

Am I missing something? Is there a reason why MySQL can't use that index?

Many thanks for any suggestions.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Subject Author Views Date
Thread optimizing timestamp indexes in MySQL hennagaijin 8422 Jun 21, 2004, 8:05 AM
Thread Re: [hennagaijin] optimizing timestamp indexes in MySQL
olivers 8205 Jun 21, 2004, 10:32 AM
Thread Re: [olivers] optimizing timestamp indexes in MySQL
hennagaijin 8273 Jun 21, 2004, 10:37 AM
Thread Re: [hennagaijin] optimizing timestamp indexes in MySQL
Alex 8215 Jun 22, 2004, 3:57 PM
Post Re: [Alex] optimizing timestamp indexes in MySQL
hennagaijin 8108 Jun 23, 2004, 5:54 AM