1

I am new to the partitioning of a table and I want to make a partition of the table by range type on the inserted_on column in this table the records are inserted around ~ 40000 daily

I have tried creating a partition table as: CREATE TABLE My.table_name_fy2022_01 PARTITION OF My.table_name FOR VALUES FROM ('2022-01-01') TO ('2022-02-01');

But this way i will have to create 12 tables per year and that I don't want to do.

My question is:- how to create a partition table such as the no. of partition table be only 12 (months wise) and stores the data according to a specific month's partition. For Example:- partition table June record of 2022-06-20 insert into June, record of 2023-06-16 insert into June, record of 2024-06-10 insert into June, and So on

Nitin
  • 11
  • 2

1 Answers1

0

PARTITION BY HASH should be used like:

PARTITION BY HASH(MONTH(use_time)) PARTITIONS 12;
J.J. Beam
  • 2,612
  • 2
  • 26
  • 55