Note that there are some explanatory texts on larger screens.

plurals
  1. PO#1503 - A UNIQUE INDEX must include all columns in the table's partitioning function
    primarykey
    data
    text
    <p>I am trying to add partitioning on a MySQL database table schema for my database table is as </p> <pre><code>CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_group_id` tinyint(3) unsigned NOT NULL DEFAULT '2', `username` varchar(50) NOT NULL, `email` varchar(80) NOT NULL, `password` varchar(50) NOT NULL, `first_name` varchar(25) DEFAULT NULL, `last_name` varchar(25) DEFAULT NULL, `gender` enum('m','f','u') NOT NULL DEFAULT 'u' COMMENT 'm=&gt;Male, f=&gt;Female, u=&gt;Unspecified', `profile_image` varchar(255) DEFAULT NULL, `reset_key` varchar(50) DEFAULT NULL, `block` enum('y','n') NOT NULL DEFAULT 'n' COMMENT 'y=&gt;blocked, n=&gt;notblocked', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; </code></pre> <p>When I run following partitioning query on table </p> <pre><code>ALTER TABLE users PARTITION BY RANGE(id) ( PARTITION p0 VALUES LESS THAN (200000), PARTITION p1 VALUES LESS THAN (400000), PARTITION p2 VALUES LESS THAN (600000), PARTITION p3 VALUES LESS THAN (800000), PARTITION p4 VALUES LESS THAN (1000000), PARTITION p5 VALUES LESS THAN (1200000), PARTITION p6 VALUES LESS THAN (1400000), PARTITION p7 VALUES LESS THAN (1600000), PARTITION p8 VALUES LESS THAN (1800000), PARTITION p9 VALUES LESS THAN (2000000) ); </code></pre> <p>it is giving me error message as </p> <p><strong><code>#1503 - A UNIQUE INDEX must include all columns in the table's partitioning function</code></strong> <img src="https://i.stack.imgur.com/6IbZS.png" alt="enter image description here"></p> <p>I am using <strong>MySQL Community Server - 5.5.16</strong></p> <p>can please anybody tell me what is error in my query?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload