[thelist] Indexing and/or Query Optimisation in MySQL
John Handelaar
john at userfrenzy.com
Mon Feb 4 08:39:01 CST 2002
Hello all,
Databases aren't really my strong point, so I've run into
something of a brick wall.
The problem: I can't figure out how to add a useful index
for a query like this one:
SELECT UID, Title, Text, Subject, AgeRating, ReadTimes, StatusFlag, StorySet
from stories
where AgeRating IN ('U', 'PG', '12')
ORDER BY Title;
I've tried adding a complex index on those columns in the
right order but it seems to have no effect on the time taken
to sort. And the table now has >13,000 rows, so i *really*
need to index it properly :-)
Am I going wrong by trying to index the columns instead
of the WHERE and ORDER BY bits?
A suggested ALTER TABLE ADD INDEX command to add the right
index for this example would help enormously...
TIA
------------------------------------------
John Handelaar
T +44 20 7209 4117 M +44 7930 681789
F +44 870 169 7657 E john at userfrenzy.com
------------------------------------------
More information about the thelist
mailing list