0

I have a MySQL table (with large data):

CREATE TABLE `rider_orders` (
  `id` NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `date` date NOT NULL,
  `shift_id` INT NOT NULL,
  `rider_id` INT NOT NULL,
  `product_id` INT NOT NULL
)

I want to add partitions month wise (by altering):

ALTER TABLE rider_orders
  PARTITION BY HASH(MONTH(date));
  • What benefit do you expect `PARTITIONing` to provide you? I have not found anyone that has benefited from Hash partitioning. Please show us your main queries; we can either provide you with the details for partitioning or show you how indexes can help you without partitioning. – Rick James Jan 13 '20 at 01:28
  • This question is a bit old, but I stumbled upon it by trying to do the same. I would say that you can do exactly as you suggested in the question. Example from my case where I have table history with datetime column 'time': ALTER TABLE history PARTITION BY HASH(month(time)) PARTITIONS 12; The big benefit is deletion of records: when the table grows to millions of records, truncate of partition is the fast way of maintaining the size. – dotokija Nov 26 '20 at 10:00

0 Answers0