I have MySQL table partitioned by range columns (c_id and created_at) and I created 2 partitions:
logs_1_2020 (c_id less than 2 and created less than 2021-01-01 00:00:00)
logs_1_2021 (c_id less than 2 and created less than 2022-01-01 00:00:00)
When I run
INSERT INTO example_log_table (c_id, data, created)
VALUES (1, 'test', '2021-10-24 18:16:08')
I'm supposed to find the result stored in logs_1_2021, but I was shocked when I found her in logs_1_2020.
Does anyone have an explanation for that?
This table SQL generator:
CREATE TABLE example_log_table (
id int auto_increment ,
c_id int,
data TEXT NOT NULL,
created DATETIME NOT NULL,
primary key (id,c_id,created)
) PARTITION BY RANGE columns (c_id,created)(
PARTITION logs_1_2020 VALUES LESS THAN (2,'2021-01-01 00:00:00'),
PARTITION logs_1_2021 VALUES LESS THAN (2,'2022-01-01 00:00:00')
);