I have to tables (on mysql 5.0.22):
Table: shelf
CREATE TABLE `shelf` (
`isbn` varchar(10) NOT NULL default '',
`product_type` char(1) default NULL,
`title` varchar(150) NOT NULL default '',
(...)
PRIMARY KEY (`isbn`),
KEY `publ_date` (`publ_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE `annotations` (
`isbn` varchar(10) NOT NULL default '',
`description` text NOT NULL,
PRIMARY KEY (`isbn`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
of course the 'isbn' is a 'foreing key' for the two tables; I'd like
to have a list of all my items with the description (if it's
present); then something like
SELECT * FROM shelf LEFT JOIN annotations ON
(shelf.isbn=annotation.isbn) ;
it works but it's SLOW!
+----+-------------+-------------+------+---------------+---------
+---------+----------------------+---------+-------+
| id | select_type | table | type | possible_keys | key |
key_len | ref | rows | Extra |
+----+-------------+-------------+------+---------------+---------
+---------+----------------------+---------+-------+
| 1 | SIMPLE | shelf | ALL | NULL | NULL |
NULL | NULL | 1343001 | |
| 1 | SIMPLE | annotations | ref | PRIMARY | PRIMARY |
12 | zcommerce.shelf.isbn | 1 | |
+----+-------------+-------------+------+---------------+---------
+---------+----------------------+---------+-------+
why the primary key is not used as index to 'speedup' the join?
what's wrong?
may be is because using that I'm making a 'dump' of the entire table?
thank you in advance for all!
bye bye
marco
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]