database - Mysql partition - How to do list partitioning of a table that contains unique column? -
i doing mysql list partitioning. table data below
---------------------------------------- id | unique_token | city | student_name | ---------------------------------------- 1 | xyz |mumbai| sanjay | ----------------------------------------- 2 | abc |mumbai| vijay | ---------------------------------------- 3 | def | pune | ajay | ----------------------------------------
in above table unique_token
column has unique key , want list partitioning city column. per mysql documentation every partition column must part of every unique key of table , hence in order list partitioning city column have create new unique key unique_key(unique_token,city)
.
now issue unique_token column should unique , if insert 2 rows in table ('xyz','banglore') , ('xyz','pune')
these rows inserted table unique_token column won't unique @ all.
i want know how list partitioning on table without having duplicate data in unique_token column??
there limitations in mysql's partition
implementation. in particular, no foreign keys
, no unique
keys unless happen include "partition key". these limitation exist because of unacceptable cost of implementing them. this, in turn, caused each partition being separate 'table', own indexes. there no "index" spans entire set of partitions. such 'global index' make fks , unique
keys viable , efficient. may come in version 5.8.
meanwhile, let me change question "how list
partitioning..." "why list
partitioning @ all?". know of no utility -- not performance, not convenience, not else, partition list
. if have reason wanting it, please explain. happy change rather negative attitude toward partitioning. (i know of only 4 use cases partition range
, topic.)
Comments
Post a Comment