Re: Index not used for "select distinct"?

2004-10-26 Thread Matthias Urlichs
Hi, Bill Easton wrote: > I think that MySQL is doing what would be expected, namely an index scan > which reads entire index on IP and selects distinct values of IP. What I expect it to do is to give me all the distinct values in that row. It should be able to notice that there are only a few dis

Re: Index not used for "select distinct"?

2004-10-24 Thread Bill Easton
Matthias, I think that MySQL is doing what would be expected, namely an index scan which reads entire index on IP and selects distinct values of IP. Whatever you do, it's going to read 10,991,123 of something and select distinct values. The use of the index saves a possible sort and allows readi

Re: Index not used for "select distinct"?

2004-10-22 Thread Matthias Urlichs
Hi, gerald_clark: > > KEY `Trap` (`IP`,`Type`,`epoch`), > > KEY `IP` (`IP`) > > > Your second key is redundant. True (there's a UNIQUE missing in there). Deleting the first key, however, doesn't change anything. -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [EMAIL PROTECTED] --

Re: Index not used for "select distinct"?

2004-10-22 Thread gerald_clark
Matthias Urlichs wrote: We have a slight opimization problem here. Given this table: CREATE TABLE `test` ( `IP` varchar(15) collate latin1_german1_ci NOT NULL default '', `Type` enum('WARN','ERROR','FATAL','UNKNOWN') collate latin1_german1_ci NOT NULL default 'WARN', `epoch` int(10) unsigned N

RE: Index not used for "select distinct"?

2004-10-22 Thread Jay Blanchard
[snip] We have a slight opimization problem here. Given this table: CREATE TABLE `test` ( `IP` varchar(15) collate latin1_german1_ci NOT NULL default '', `Type` enum('WARN','ERROR','FATAL','UNKNOWN') collate latin1_german1_ci NOT NULL default 'WARN', `epoch` int(10) unsigned NOT NULL defaul

Index not used for "select distinct"?

2004-10-22 Thread Matthias Urlichs
We have a slight opimization problem here. Given this table: CREATE TABLE `test` ( `IP` varchar(15) collate latin1_german1_ci NOT NULL default '', `Type` enum('WARN','ERROR','FATAL','UNKNOWN') collate latin1_german1_ci NOT NULL default 'WARN', `epoch` int(10) unsigned NOT NULL default '0',