手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >MySQL一个索引最多有多少个列?真实的测试例子
MySQL一个索引最多有多少个列?真实的测试例子
摘要:最多16列。createtabletest(f1int,f2int,f3int,f4int,f5int,f6int,f7int,f8int,...

最多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>

【MySQL一个索引最多有多少个列?真实的测试例子】相关文章:

在MySQL字段中使用逗号分隔符的方法分享

MySQL 性能优化的最佳20多条经验分享

MySQL 查询某个字段不重复的所有记录

使MySQL查询区分大小写的实现方法

MySQL中使用case when 语句实现多条件查询的方法

MySQL 错误处理例子[译]

使用Rotate Master实现MySQL 多主复制的实现方法

一个字段同时满足多个条件的查询

重装MySQL最后一步失败的完美解决办法

MySQL数据表损坏的正确修复方案

精品推荐
分类导航