Let us suppose I have a table created as follows:
create table `test_table` (
`col1` varchar(128) NOT NULL,
PRIMARY KEY (`col1`(16))
);
Now, suppose I have a script that is examining the schema, looking for information about primary keys. How can that script find the index prefix length (16 in the above example) without parsing the output of show create table? This information is not in information_schema.key_column_usage (in MySQL 5.1, anyway), but is it somewhere else in information_schema?
Try to use information_schema.STATISTICS table (
SUB_PARTfield) –or
SHOW INDEX statement.