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

MYSQL
使用mysql的mysqldump实现自动备份
MySQL数据导出和导入工具:mysqldump
怎样从Windows命令行启动您的MySQL
细化解析实现MySQL查询结果的分页显示
强大的工具 MySQL客户端命令行应用技巧
MySQL 5.0.16中出现乱码问题的解决方法
phpMyBackupPro备份恢复Mysql数据库
如何才能关闭MySQL数据库中错误提示音
数据库竟然崩溃了!马上让它恢复正常!
怎么显示 MySQL 数据库里表的概要呢?
自动恢复MySQL数据库的日志文件全教程
实例解说MySQL数据库中文问题的解决方案
优化MySQL数据库性能的几招儿好办法
MySQL加密函数保护Web网站敏感数据
使用PHP小程序清除Mysql中恼人的死连接
Mysql中用utf8存储而用gbk输出的实现
浅谈怎么才能在MySQL中直接储存图片
用特殊的MySQL运算符获得更多数据比较功能
MySQL数据库中的重要资料需要怎样保护?
假如忘记MySQL root密码应当怎样找回

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 193 ::
收藏到网摘: 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>