Hi,
If you have that date column in your where clause for example:
SELECT ...... FROM ..... WHERE tstamp > NOW() - INTERVAL 1 WEEK;
Then it's essential to index that column to speed up a table with lots of data.
On a table with many rows, an index on a timestamp column is invaluable. However, I should point out that having an index on a column does add a small performance overhead to inserts and updates so if you're not going to use it in your where clauses then there's not much point in adding it.
Cheers,
Andrew
-----Original Message-----
From: Cantwell, Bryan [mailto:bcantwell@stripped]
Sent: 24 April 2009 22:56
To: mysql@stripped
Subject: Index time columns?
I have a debate with someone about indexes on time columns.
So I ask the community, should you put an index on a timestamp column of a table?
Thanks...
| Thread |
|---|
| • Oracle , what else ? | Gilles MISSONNIER | 21 Apr |
| • Re: Oracle , what else ? | Simon Connah | 21 Apr |
| • Re: Oracle , what else ? | Martijn Tonies | 21 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 22 Apr |
| • Re: Oracle , what else ? | Glyn Astill | 23 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 23 Apr |
| • Re: Oracle , what else ? | mos | 21 Apr |
| • Re: Oracle , what else ? | Andy Shellam | 21 Apr |
| • Re: Oracle , what else ? | Yves Goergen | 23 Apr |
| • RE: Oracle , what else ? | Gabriel - IP Guys | 23 Apr |
| • RE: Oracle , what else ? | Janek Bogucki | 28 Apr |
| • RE: Oracle , what else ? | John Daisley | 28 Apr |
| • RE: Oracle , what else ? | mos | 28 Apr |
| • RE: Oracle , what else ? | Janek Bogucki | 28 Apr |
| • Re: Oracle , what else ? | Martijn Tonies | 24 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 24 Apr |
| • Re: Oracle , what else ? | mos | 24 Apr |
| • Re: Oracle , what else ? | John Daisley | 22 Apr |
| • Re: Oracle , what else ? | Arthur Fuller | 22 Apr |
| • Re: Oracle , what else ? | NĂ©stor | 22 Apr |
| • Re: Oracle , what else ? | mos | 22 Apr |
| • Re: Oracle , what else ? | Krishna Chandra Prajapati | 22 Apr |
| • Re: Oracle , what else ? | Martijn Tonies | 22 Apr |
| • RE: Oracle , what else ? | Joshua D. Drake | 24 Apr |
| • Re: Oracle , what else ? | David Sparks | 24 Apr |
| • Re: Oracle , what else ? | Glyn Astill | 24 Apr |
| • Re: Oracle , what else ? | David Sparks | 24 Apr |
| • Re: Oracle , what else ? | Glyn Astill | 24 Apr |
| • Index time columns? | Bryan Cantwell | 24 Apr |
| • RE: Index time columns? | Andrew Braithwaite | 27 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 27 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 27 Apr |
| • Re: Oracle , what else ? | Joshua D. Drake | 27 Apr |