I have a large table which contains a date_time column.
The table contains 2 generated columns year, and month which are extracted from the date_time values and are used for partitioning.
I have the following question.
If I run the query
SELECT *
FROM table
WHERE date_time > '2022-07-01' and date_time < '2022-07-09'
This query will scan all the files
If I modify the query to
SELECT *
FROM table
WHERE date_time > '2022-07-01' and date_time < '2022-07-09'
AND year = 2022 and month = 7
Now pruning will get applied and the query will run ~ 20 times faster.
I would be expecting that given that there is a relationship defined between date_time and columns year and month, pruning would be applied even if only date_time is specified in the where clause.
Am I missing something in my config or is my understanding incorrect?
Thanks,
Andrej