广

MYSQL

  • MYSQL
  • MSSQL
  • Redis
  • MongoDB
  • oracle数据库
  • 数据管理

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

    2018-05-08 11:29:16 次阅读 稿源:互联网
    零七网广告
    全网推广平台,软文发布
    最多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>

    零七网部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与零七网进行文章共享合作。

    零七网广告
    零七网广告
    零七网广告
    零七网广告