List:General Discussion« Previous MessageNext Message »
From:Sebastian Date:June 10 2005 10:45am
Subject:when to use Indexes
View as plain text  
i have a table with several thousand records. i want to know if adding 
an index will improve things, example:

| id | item | text | runtime | dateline

now say i create this query:

$stats = mysql_query("
SELECT COUNT(*) as total, AVG(runtime) as avgtime
FROM table WHERE dateline > ".strtotime('6 hours ago')."

should dateline be an index?
basically, i would like to know when i should create an index, when an 
index is not needed, and what columns should be indexes..

any urls which explains all this would be helpful.
when to use IndexesSebastian10 Jun
  • Re: when to use IndexesPhilippe Poelvoorde10 Jun
  • Re: when to use IndexesGleb Paharenko10 Jun
  • Re: when to use IndexesJigal van Hemert10 Jun