56,687
社区成员
发帖
与我相关
我的任务
分享
mysql> show create table user;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| user | CREATE TABLE `user` (
`a` int(11) DEFAULT NULL,
`ttoken` varchar(2048) DEFAULT NULL
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root:123@192.168.0.10/test/user' |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> create index idx_2 on user(a);
ERROR 1031 (HY000): Table storage engine for 'user' doesn't have this option
mysql>
mysql> show create table user;
+-------+--------------------------------
| Table | Create Table
+-------+--------------------------------
| user | CREATE TABLE `user` (
`a` int(11) DEFAULT NULL,
`ttoken` varchar(2048) DEFAULT NULL,
KEY `idx_1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------
1 row in set (0.00 sec)
mysql> explain select * from user where a=1;
+----+-------------+-------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+------+-------------+
| 1 | SIMPLE | user | ALL | NULL | NULL | NULL | NULL | 4 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+------+-------------+
1 row in set (0.01 sec)
mysql> show index from user;
Empty set (0.01 sec)