-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of unavailable indexes in Scan hints
As showed by the regression tests, this fixes a lot of correctness issues behind the hints considered as "used" by the module but not actually used because the index restrictions were applied before enforcing a scan method. For example, an index IndexScan with a list of indexes not used caused two problems: - The hint would be marked as used, but it resulted in being not used, falling down to a sequential scan. - Discarding all the indexes in the hint could cause invisible regressions, as the hint would fail to consider any existing hints. There was also an extra case with IndexScanRegexp where having a list of indexes available turns out to cause a sequential scan and still mark the hint as used. This commit now prevents restrict_indexes from removing any indexes from the relation index list if none of the hinted indexes are available, and switches the scan enforcement method to be after the index restrictions are applied. This safeguard prevents an IndexScan hint supplied without any available indexes to result in a sequential scan, for example. Per discussion on #136. Author: Sami Imseih Backpatch-through: 13
- Loading branch information
Showing
3 changed files
with
158 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.