It sounds like you are looking for a quickie. Sorry, couldn't resist.
You should run optimize table to make sure your indexes are optimized.
Also, you should check which index is being used first. Your sex column
probably is split 50/50, so if MySQL is optimizing your query to use
the sex index
Don't forget to run "optimize table" after you build
the combined index or make significant changes.
-- Greg
PS: Sorry to hear of MySQL's "gender issues" ;-)
On Mon, Jan 19, 2004 at 10:20:12AM -0500, Balazs Rauznitz wrote:
>
> I saw surprisingly slow query results on columns that were indexed.
I saw surprisingly slow query results on columns that were indexed.
Here's the table definition:
create table sex (
id integer,
sex char(1));
create index id_index on sex (id);
create index sex_index on sex (sex);
Then I loaded a million rows, id was from 1 to 1_000_000, sex was
randomly 'F' o