php - Partitioning of table in mysql for MYISAM eninge based on year -


i trying partition table based on year range.

but i'm getting following error "#1503 - primary key must include columns in table's partitioning function".

following query

create table if not exists `t2123` (   `j_id` int(11) not null auto_increment,   `u_id` int(11) not null,   `w_id` int(5) not null,   `p_id` int(5) not null,   `s_p_id` int(5) not null,   `p_t` tinyint(3) unsigned not null,   `a_n` int(5) not null,       `type` enum('gp','ngp','pgp','pagp') not null,   `p_p` int(11) not null,   `s_p` int(11) not null,   `p_c` float not null,   `s_c` float not null,   `s_p_p_c` float not null default '0',   `g_d` date not null,  `datetimes` timestamp not null default '0000-00-00 00:00:00',   `c_c` double  default '0',   `c_m` double default '0',   `c_y` double  default '0',   `c_k` double  default '0' ,   `c_total` double  default '0' ,   `p_a` float  default '0',   primary key (`j_id`),   unique key(j_id, g_d),    key `u_id` (`u_id`),   key `w_id` (`w_id`),   key `p_id` (`p_id`),   key `s_p_id` (`s_p_id`),   key `a_n` (`a_n`),   key `g_d` (`g_d`)   ) engine=myisam  partition range  (j_id + year(g_d)) (     partition t2_2012 values less (2012),     partition t2_2013 values less (2013) ); 

please suggest me how can create partition?

as error message advises:

a primary key must include columns in table's partitioning function

your partitioning function refers j_id , g_d while primary key covers j_id.

by way, unique constraint useless (unique key(j_id, g_d)) because j_id unique definition (it primary key).

in fact want primary key on (j_id, g_d)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -