【TiDB Environment】Production
【TiDB Version】v4.0.10
【Reproduction Path】
【Encountered Problem: Phenomenon and Impact】
Abnormal SQL execution time
Abnormal time consumption when querying partition tables that scan partitions with no data
【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】
SQL:
SELECT
xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx
FROM
test_table
WHERE
(
aaaa IN (
‘xxx’,‘xxx’,‘xxx’
)
)
AND (
date IN (
‘xxx’,‘xxx’,‘xxx’
)
);
Partition pruning is only supported after version 5.X, and it actually matures in version 6.5 LTS.
Global partitioned indexes are similar. If you have high requirements for partitioning, you might consider upgrading your version (it is recommended to test before upgrading).