Open Dzyszla opened 1 year ago
This is by design. OR condition can be mapped to an index only if all ORed parts can use an index, which is obviously impossible for 1 = 0
. Maybe such constant conditions could be tracked somehow to improve the current rules, but I wouldn't assign it a high priority.
I think that throwing out such constant conditions already at the query optimization stage would help a lot. Look at the issue #6941 - there simply skip (remove) dummy condition it's all you need and then rest works exactly as expect.
Table:
SELECT (statistics and data in table no matters):
Use only:
PLAN (T_TEST INDEX (T_TEST_IDX2))
But when remove from OR-list dummy condition:
Now use booth:
PLAN (T_TEST INDEX (T_TEST_IDX1, T_TEST_IDX1, T_TEST_IDX2))
Affected version: 3.0.11