Drop the 'sex_index'
Basically when you have few unique values in a column
indexing it doesn't always help.
I setup this table with the 1,000,000 random entries
and query time is nearly the same for your 2 queries
below.
CREATE TABLE sex (
id int(11) unsigned NOT NULL auto_increment,
sex ch
In the last episode (Jan 20), Balazs Rauznitz said:
> On Tue, Jan 20, 2004 at 08:23:32PM +0100, Aleksandar Bradaric wrote:
>
> mysql> explain select count(*) from sex where id>459000 and id <=46 and sex =
> 'M';
> +---+--++---+-+---
On Tue, Jan 20, 2004 at 08:23:32PM +0100, Aleksandar Bradaric wrote:
> Hi,
>
> >> > Any way to make this faster ?
> >>
> >> Try to create an index on both fields:
> >>
> >> create index idsex_index on sex (id, sex)
>
> > Tried that; same results...
>
> Could you post the result of the EX
Hi,
>> > Any way to make this faster ?
>>
>> Try to create an index on both fields:
>>
>> create index idsex_index on sex (id, sex)
> Tried that; same results...
Could you post the result of the EXPLAIN command on that
query?
Take care,
Aleksandar
--
MySQL General Mailing List
For l
On Tue, Jan 20, 2004 at 07:09:46PM +0100, Aleksandar Bradaric wrote:
> Hi,
>
> > Any way to make this faster ?
>
> Try to create an index on both fields:
>
> create index idsex_index on sex (id, sex)
Tried that; same results...
Balazs
--
MySQL General Mailing List
For list archives: http:
Hi,
> Any way to make this faster ?
Try to create an index on both fields:
create index idsex_index on sex (id, sex)
Take care,
Aleksandar
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
While doing some benchmarks the other day, 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