Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2312198
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: Mysql/postgreSQL

2011-06-02 09:39:41

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

这篇文章刚好可以解决同事的疑问,转来
当然这么测,我觉得很没意思哈,可能是我孤陋寡闻,我觉得没有必要一个索引可以创建在这么多个列上
阅读(1600) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~