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

MYSQL
MS SQL7.0的数据迁移到MySQL上的一种方法
MySql ODBC进行MYsql和MSsql7的数据转换
MySQL优化全攻略--相关数据库命令
MySQL数据库接口的VC实现与应用(1)
MySQL数据库接口的VC实现与应用(2)
Tomcat5配置MySQL JDBC数据库连接池
如何从MySQL数据库表中检索数据
数据库中MySQL各种字段的取值范围
在Windows上的MySQL UDF开发应用
SCO下用gcc编译调用mysql数据库的程序
获取SQL Server数据库里表占用容量大小
MySQL查询优化技术系列讲座之使用索引
MySQL数据库单一表突破4G限制的实现方法
使用mysqlhotcopy备份MySQL
phpMyAdmin 3.0.1.1 - MySQL管理利器
Linux下MySQL的一些基本使用方法
CentOS编译Mysql 4.0.27数据库问题解决
MySqlODBC进行MYsql和MSsql7的数据转换
MM.MySQL MySQL的JDBC驱动程序的介绍
一个简单的mysql数据库分页的程序模板

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


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