In MySQL, does putting SELECT foo increase in performance if foo is indexed?
At RedditMirror.cc, I have a database with 1.2 million records in the GrabbedSites table, a number that increases by approx 500-2000 per day.
Early in my career, I was mentored that the only columns that should be indexed are those which you
- will do WHERE or JOIN SELECT/UPDATEs on in the future,
- need them to be UNIQUE data.
Because of that, GrabbedSites only has one key indexed (besides the primary key): categoryID, but 8 columns are queried.
The website receives dramatic bursts of flash traffic, sometimes over 100,000 unique visitors a day, and the DB becomes "taxed" at about 20% usage.
So I'm wondering, would there be a performance advantage in MySQL to adding indexes to all 8 frequently-queried columns??
Edit: Query is:
SELECT url,
title,
published,
reddit_key,
UNIX_TIMESTAMP(last_fetched) last_fetched,
comment_link
FROM GrabbedSites
WHERE published BETWEEN DATE_SUB('2010-09-03', INTERVAL 1 DAY)
AND '2010-09-03'
ORDER BY published;
Only index is "published".
Explain says: Using where; Using filesort