Mysql – Automatically partition a table in thesql (pythesql) everyday for new data

MySQLpartitioning

Im still figuring out partitioning in SQL.

Is it possible to automatically partition a table everyday for new data? For example, on Monday, I have one partition. On Tuesday, automatically create a new partition, insert that day's data into the new partition and so on… Is reorganize partition the right way to go?

Best Answer

Yes REORGANIZE of a "future" partition is the right way. See http://mysql.rjweb.org/doc.php/partitionmaint for a discussion of why, plus sample Perl code.

Do not create more partitions that you need immediately; it leads to inefficiencies. Instead, check to see if you need a new partition more often than simply "just in time".