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

MYSQL
Mysql数据库常见的“#1251”錯誤分析
SQL 查询语句积累
MyGeneration连接MySql数据库的解决办法
新手扫盲:MySQL入门基础知识简介
如何在MySQL中获得更好的搜索结果
浅谈如何应用JDBC连接数据库MySQL
实际应用:MySQL5存储过程的编写实践
MySQL5的异常处理
SQL查询语句精华使用简要
MySQL数据库基础:数据类型及列类型
MySQL 忘记口令的解决办法
MySQL账户相关
MySQL存在权限提升及安全限制绕过漏洞
MySQL手册版本 5.0.20-MySQL优化(六)
新手入门--全面介绍MySQL的基础应用
一步步教你在Windows环境下安装MySQL
MySQL手册版本 5.0.20-MySQL优化(一)
MySQL手册版本 5.0.20-MySQL同步(三)
SQL查询语句对象化的实现(C#)
真的? MySQL被计划转为Linux文件系统

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


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