Mysql: Why only unique/primary keys must have all the columns used in partitioning expression?
-
As per mysql explaination "all columns used in the partitioning expression for a partitioned table must be part of every unique key that the table may have". Why only unique/primary keys, why not other keys too ?
-
Answer:
I believe it's so that a new INSERT/UPDATE can check for duplicate key violations by accessing only one partition. This is not necessary for non-unique indexes. Any value in a non-unique key can occur in more than one partition, and there's no conflict. Note also that in the MySQL source code, in file sql/sql_partition.cc, there's a function check_primary_key(), which has a comment: This function verifies that if there is a primary key that it contains all the fields of the partition function. This is a temporary limitation that will hopefully be removed after a while. So I would infer that there are other ideas about how to implement partitioning without requiring unique indexes be included in the partition function. As in any project, there are more good ideas than engineer-hours, and work must be done by prioritizing the features of most demand.
Bill Karwin at Quora Visit the source
Related Q & A:
- Why Can't I find my databases from Mysql on linux?Best solution by Database Administrators
- How to skip columns empty in CSV file when importing into MySQL table using LOAD DATA INFILE?Best solution by Stack Overflow
- Is it possible to conditionally select columns in MySQL?Best solution by Yahoo! Answers
- Can an external HD be used as my primary HD?Best solution by tomshardware.com
- Why are the keys on a calculator opposite to the keys on a phone?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.