-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Description
I created partial index
CREATE INDEX IDX_TRIAL_LINE_PLACE_WIN
ON TRIAL_LINE(PLACE_WON)
WHERE PLACE_WON = 1 OR PLACE_WON = 2 OR PLACE_WON = 3;And execute query:
SELECT COUNT(*)
FROM TRIAL_LINE
WHERE PLACE_WON = 1plan:
PLAN (TRIAL_LINE NATURAL)
Select Expression
-> Aggregate
-> Filter
-> Table "TRIAL_LINE" Full Scan
However, if you run a query like this, the index will be used:
SELECT COUNT(*)
FROM TRIAL_LINE
WHERE PLACE_WON = 1 OR PLACE_WON = 2PLAN (TRIAL_LINE INDEX (IDX_TRIAL_LINE_PLACE_WIN, IDX_TRIAL_LINE_PLACE_WIN, IDX_TRIAL_LINE_PLACE_WIN))
Select Expression
-> Aggregate
-> Filter
-> Table "TRIAL_LINE" Access By ID
-> Bitmap And
-> Bitmap
-> Index "IDX_TRIAL_LINE_PLACE_WIN" Full Scan
-> Bitmap Or
-> Bitmap
-> Index "IDX_TRIAL_LINE_PLACE_WIN" Range Scan (full match)
-> Bitmap
-> Index "IDX_TRIAL_LINE_PLACE_WIN" Range Scan (full match)
Naturally, the index will be used for the full expression:
SELECT COUNT(*)
FROM TRIAL_LINE
WHERE PLACE_WON = 1 OR PLACE_WON = 2 OR PLACE_WON = 3It seems to me that this clearly contradicts what is described in the release note:
The search condition defined for the index contains ORed boolean expressions and one of them is explicitly included in the WHERE condition;