当前位置: 首页 > 图文教程 > 数据库 > MYSQL > MySQL一个索引最多有多少个列?真实的测试例子

MYSQL
MYSQL常用命令与实用技巧
用mysqldump备份和恢复指定表的方法
MYSQL常见出错代码对照
dmysql自己封装的mysql库
虚拟主机MySQL数据库的备份与还原的方法
推荐没有虚拟主机的小巧的Mysql数据库备份脚本(PHP)
MySQL数据库备份方法说明
asp采用ODBC接口访问MySQL的方法
找到一种不错的从SQLServer转成Mysql数据库的方法
MySQL UDF调试方式debugview的相关方法
使用dreamhost空间实现MYSQL数据库备份方法
MYSQL导入导出命令详解
MYSQL命令行模式管理MySql的一点心得
解决MySQL数据库中文模糊检索问题的方法
Mysql以utf8存储gbk输出的实现方法提供
mysql连接过多和死掉以及拒绝服务的解决方法
在MySQL数据库中复位根用户的密码的方法
mysql数据库查询优化 mysql效率
MySQL数据库的出错代码列表
MySQL 1067错误解决方法集合

MYSQL 中的 MySQL一个索引最多有多少个列?真实的测试例子


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 157 ::
收藏到网摘: n/a

MySQL一个索引最多有多少个列?下面是具体的实现代码。 最多16列。
create table test (
f1 int,
f2 int,
f3 int,
f4 int,
f5 int,
f6 int,
f7 int,
f8 int,
f9 int,
f10 int,
f11 int,
f12 int,
f13 int,
f14 int,
f15 int,
f16 int,
f17 int
);
create index idx_test_16 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16);
create index idx_test_17 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17);
运行结果如下:

mysql> create table test (
-> f1 int,
-> f2 int,
-> f3 int,
-> f4 int,
-> f5 int,
-> f6 int,
-> f7 int,
-> f8 int,
-> f9 int,
-> f10 int,
-> f11 int,
-> f12 int,
-> f13 int,
-> f14 int,
-> f15 int,
-> f16 int,
-> f17 int
-> );
Query OK, 0 rows affected (0.06 sec)
mysql>
mysql> create index idx_test_16 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16);
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> create index idx_test_17 on test (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17);
ERROR 1070 (42000): Too many key parts specified; max 16 parts allowed
mysql>