Re: Select on indexed columns

2004-01-21 Thread olinux
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

Re: Select on indexed columns

2004-01-20 Thread Dan Nelson
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'; > +---+--++---+-+---

Re: Select on indexed columns

2004-01-20 Thread Balazs Rauznitz
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

Re[2]: Select on indexed columns

2004-01-20 Thread Aleksandar Bradaric
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

Re: Select on indexed columns

2004-01-20 Thread Balazs Rauznitz
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:

Re: Select on indexed columns

2004-01-20 Thread Aleksandar Bradaric
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]

Select on indexed columns

2004-01-20 Thread Balazs Rauznitz
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