加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

Mysql必读MySQL一个索引最多有多少个列?真实的测试例子

发布时间:2020-12-12 02:39:56 所属栏目:MySql教程 来源:网络整理
导读:《Mysql必读MySQL一个索引最多有多少个列?真实的测试例子》要点: 本文介绍了Mysql必读MySQL一个索引最多有多少个列?真实的测试例子,希望对您有用。如果有疑问,可以联系我们。 最多16列. create table test ( f1 int, f2 int, f3 int, f4 int, f5 int, f

《Mysql必读MySQL一个索引最多有多少个列?真实的测试例子》要点:
本文介绍了Mysql必读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,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,f16);
Query OK,0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> create index idx_test_17 on test (f1,f17);
ERROR 1070 (42000): Too many key parts specified; max 16 parts allowed
mysql>

欢迎参与《Mysql必读MySQL一个索引最多有多少个列?真实的测试例子》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读