Hello,

I have the following table:

CREATE TABLE `list_datas_1` (
  `list_id` bigint(20) NOT NULL,
  `locale_id` bigint(20) NOT NULL,
  `record_id` bigint(20) NOT NULL,
  `segment_0` longtext,
  `segment_1` longtext,
  `segment_0_sk` longblob,
  `segment_1_sk` longblob,
  KEY `record_id` (`record_id`),
  KEY `list_id` (`list_id`),
  KEY `datas` (`locale_id`,`segment_0_sk`(677),`segment_1_sk`(338)),
  CONSTRAINT `list_datas_1_ibfk_1` FOREIGN KEY (`list_id`) REFERENCES
`list_definitions` (`list_definition_id`),
  CONSTRAINT `list_datas_1_ibfk_2` FOREIGN KEY (`locale_id`) REFERENCES
`locales` (`locale_id`),
  CONSTRAINT `list_datas_1_ibfk_3` FOREIGN KEY (`record_id`) REFERENCES
`records` (`record_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

When I use the following statement:

select record_id, segment_0_sk, segment_1_sk from list_datas_1 order by
locale_id, substring(segment_0_sk,1,677);

explain returns the following datas:

+----+-------------+--------------+------+---------------+------
+---------+------+------+----------------+
| id | select_type | table        | type | possible_keys | key  |
key_len | ref  | rows | Extra          |
+----+-------------+--------------+------+---------------+------
+---------+------+------+----------------+
|  1 | SIMPLE      | list_datas_1 | ALL  | NULL          | NULL | NULL
| NULL | 2697 | Using filesort |
+----+-------------+--------------+------+---------------+------
+---------+------+------+----------------+

The two columns in the order by clause is a prefix of the 'datas' index.
This index is not used at all for the select ?

Thanks for you replies.

vdg


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to