lucabecchetti / laravel-mysql-partition

Useful Laravel package to easily work with MySQL Partition
Other
139 stars 26 forks source link

is it possible to add partition? #1

Closed royanon closed 4 years ago

royanon commented 4 years ago

Because re-do the whole table partitions takes a long time, can we have a way to add a new partition that will re-organize the future partition?

lucabecchetti commented 4 years ago

I'm sorry, Not for now!

ipearx commented 2 years ago

For anyone else reading this, one answer is to re-structure and split the 'future' partition, to create the new partition you want. The technique is described here http://mysql.rjweb.org/doc.php/partitionmaint

This library doesn't support it, so I issued a mysql statement directly e.g.

DB::statement("ALTER TABLE tracking REORGANIZE PARTITION future INTO (
                PARTITION p" . $tomorrow . " VALUES LESS THAN (".$tomorrow."), 
                PARTITION future VALUES LESS THAN MAXVALUE
            );");

Keep in mind: