分区表,插入约5kw数据,查询时1使用分区卡死,2使用条件下推很快,explain看计划都识别到分区1/28
CREATE TABLE `test_tbl_field_auto_part` (
`num1` BIGINT NOT NULL,
`name1` VARCHAR(100) NULL,
`rndnum1` DOUBLE NULL,
`ph1` BIGINT NULL,
`rndstr1` TEXT NULL,
`rndstr2` TEXT NULL,
`dt1` DATETIME NOT NULL,
`dt2` DATETIME NULL
) ENGINE=OLAP
DUPLICATE KEY(`num1`, `name1`)
AUTO PARTITION BY RANGE (date_trunc(`dt1`, 'year'))
()
DISTRIBUTED BY HASH(`num1`);
-- 1
explain select t.*
from ODS.test_tbl_field_auto_part partition(p20240101000000) t;
-- 2
explain select t.*
from ODS.test_tbl_field_auto_part t
where t.dt1 between '20240101' and '2024-12-31 23:59:59';