P
P
Prescott2012-04-20 13:21:42
MySQL
Prescott, 2012-04-20 13:21:42

Partitioning tables in MySQL?

Good day.
There is a table with orders more than 10 million records. I want to break into partitions by date of creation quarterly. PK - id INT AUTO_INCREMENT. When altering a table, I get: A PRIMARY KEY must include all columns in the table's partitioning function. I cannot make the PK composite, since the uniqueness of the id field is important to me, especially since I consider the very idea of ​​such a PK to be nonsense.
How to be? Isn't there a normal way to split a table?
PS: I actually read the Doc, but I didn’t find a solution there, perhaps because of bad English, so please don’t throw quotes from there =)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly, 2012-04-20
@taliban

I did it manually, but at that time there were no partitions and the division was not by date, but by primer id =) So in the worst case, hit the tables with your hands and give them names date('Y_m_d') (let's say). As a result, Queries work fine, there are no problems finding the desired table, but it’s bad that all this is not done automatically.

M
MuXaJIbI4, 2012-04-20
@MuXaJIbI4

here everything is written what and how to do dev.mysql.com/doc/refman/5.1/en/partitioning.html
but in general here is a good article for reflection highload.com.ua/index.php/2009/05/06/%D1% 88%D0%B0%D1%80%D0%B4%D0%B8%D0%BD%D0%B3-%D0%BF%D0%B0%D1%80%D1%82%D0%B8%D1%86 %D0%B8%D0%BE%D0%BD%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D1%80% D0%B5%D0%BF%D0%BB%D0%B8%D0%BA%D0%B0%D1%86/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question