MySQL一個(gè)索引最多有多少個(gè)列?真實(shí)的測(cè)試?yán)?/h1>
更新時(shí)間:2009年07月01日 22:22:21 作者:
MySQL一個(gè)索引最多有多少個(gè)列?下面是具體的實(shí)現(xiàn)代碼。
最多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);
運(yùn)行結(jié)果如下:
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>
相關(guān)文章
-
詳解MySQL如何實(shí)現(xiàn)數(shù)據(jù)批量更新
最近需要批量更新大量數(shù)據(jù),習(xí)慣了寫(xiě)sql,所以還是用sql來(lái)實(shí)現(xiàn),下面這篇文章主要給大家總結(jié)介紹了關(guān)于MySQL批量更新的方式,需要的朋友可以參考下 2023-10-10
-
mysql 8.0.15 版本安裝教程 連接Navicat.list
這篇文章主要為大家詳細(xì)介紹了mysql 8.0.15 版本安裝教程,連接Navicat.list,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下 2019-08-08
-
SQL使用ROW_NUMBER() OVER函數(shù)生成序列號(hào)
這篇文章主要介紹了SQL使用ROW_NUMBER() OVER函數(shù)生成序列號(hào),ROW_NUMBER()從1開(kāi)始,為每一條分組記錄返回一個(gè)數(shù)字,下面文章內(nèi)容具有一定的參考價(jià)值,需要的小伙伴可以參考一下 2021-12-12
-
mysql中json類(lèi)型字段的基本用法實(shí)例
大家應(yīng)該都知道m(xù)ysql中的字段可以使用json的格式來(lái)進(jìn)行存儲(chǔ),下面這篇文章主要給大家介紹了關(guān)于mysql中json類(lèi)型字段的基本用法,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下 2022-08-08
-
淺談MySQL使用笛卡爾積原理進(jìn)行多表查詢(xún)
這篇文章主要介紹了淺談MySQL使用笛卡爾積原理進(jìn)行多表查詢(xún),
文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧 2020-07-07
-
MySQL錯(cuò)誤“Specified key was too long; max key length is 1000 b
今天在為數(shù)據(jù)庫(kù)中的某兩個(gè)字段設(shè)置unique索引的時(shí)候,出現(xiàn)了Specified key was too long; max key length is 1000 bytes錯(cuò)誤 2010-08-08
最新評(píng)論
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);
運(yùn)行結(jié)果如下:
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>
相關(guān)文章
詳解MySQL如何實(shí)現(xiàn)數(shù)據(jù)批量更新
最近需要批量更新大量數(shù)據(jù),習(xí)慣了寫(xiě)sql,所以還是用sql來(lái)實(shí)現(xiàn),下面這篇文章主要給大家總結(jié)介紹了關(guān)于MySQL批量更新的方式,需要的朋友可以參考下2023-10-10
mysql 8.0.15 版本安裝教程 連接Navicat.list
這篇文章主要為大家詳細(xì)介紹了mysql 8.0.15 版本安裝教程,連接Navicat.list,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-08-08
SQL使用ROW_NUMBER() OVER函數(shù)生成序列號(hào)
這篇文章主要介紹了SQL使用ROW_NUMBER() OVER函數(shù)生成序列號(hào),ROW_NUMBER()從1開(kāi)始,為每一條分組記錄返回一個(gè)數(shù)字,下面文章內(nèi)容具有一定的參考價(jià)值,需要的小伙伴可以參考一下2021-12-12
mysql中json類(lèi)型字段的基本用法實(shí)例
大家應(yīng)該都知道m(xù)ysql中的字段可以使用json的格式來(lái)進(jìn)行存儲(chǔ),下面這篇文章主要給大家介紹了關(guān)于mysql中json類(lèi)型字段的基本用法,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-08-08
淺談MySQL使用笛卡爾積原理進(jìn)行多表查詢(xún)
這篇文章主要介紹了淺談MySQL使用笛卡爾積原理進(jìn)行多表查詢(xún), 文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07
MySQL錯(cuò)誤“Specified key was too long; max key length is 1000 b
今天在為數(shù)據(jù)庫(kù)中的某兩個(gè)字段設(shè)置unique索引的時(shí)候,出現(xiàn)了Specified key was too long; max key length is 1000 bytes錯(cuò)誤2010-08-08

