Re: Query seem to be using the wrong index / InnoDB

2001-12-05 Thread Dr. Frank Ullrich
Hi, how big is the result set in your 2 queries (compared to the number of rows in the table)? Seems that in the 2nd case the query was much more selective than in the first case. Therefore using an index in the first query might have been considered not advantageous. But try this also with 'sel

Query seem to be using the wrong index / InnoDB

2001-12-05 Thread Maciek Dobrzanski
Hi, This happens on MySQL 3.23.44 CREATE TABLE ttble ( `k1` varchar(100) NOT NULL default '', ... `k2` varchar(65) NOT NULL default '', ... PRIMARY KEY (`k1`, `k2`) ... ) TYPE=InnoDB When k1 is compared to a string with only one known letter... EXPLAIN SELECT * FROM ttb