Re: Partitioning causes duplicate key error
Posted by:
fz wsc
Date: May 27, 2006 03:47AM
So I add "KEY" in the "create table" statement:
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`p1` varchar(50) NOT NULL,
KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1
COLLATE utf8_general_ci
PARTITION BY LINEAR KEY(`p1`)
PARTITIONS 4;
=============== the result is wrong apparently ===========
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.01 sec)
mysql> insert into t1 values(null,'abc');
Query OK, 1 row affected (0.00 sec)
mysql> select * from t1;
+----+-----+
| id | p1 |
+----+-----+
| 1 | abc |
| 1 | abc |
| 1 | abc |
| 1 | abc |
| 1 | abc |
| 1 | abc |
| 1 | abc |
+----+-----+
7 rows in set (0.01 sec)
mysql>