Skip to content

Commit 4f08586

Browse files
Remove obsolete nbtree equality key comments.
_bt_first reliably uses the same equality key (on each index column) for initial positioning purposes as the one that _bt_checkkeys can use to end the scan following commit f09816a. _bt_first no longer applies its own independent rules to determine which initial positioning key to use on each column (for equality and inequality keys alike). Preprocessing is now fully in control of determining which keys start and end each scan, ensuring that _bt_first and _bt_checkkeys have symmetric behavior. Remove obsolete comments that described why _bt_first was expected to use at least one of the available required equality keys for initial positioning purposes. The rules in this area are now maximally strict and uniform, so there's no reason to draw attention to equality keys. Any column with a required equality key cannot have a redundant required inequality key (nor can it have a redundant required equality key). Oversight in commit f09816a, which removed similar comments from _bt_first, but missed these comments. Author: Peter Geoghegan <pg@bowt.ie> Backpatch-through: 18
1 parent 645c1e2 commit 4f08586

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/backend/access/nbtree/nbtsearch.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,12 +2246,9 @@ _bt_steppage(IndexScanDesc scan, ScanDirection dir)
22462246
*
22472247
* _bt_first caller passes us an offnum returned by _bt_binsrch, which might
22482248
* be an out of bounds offnum such as "maxoff + 1" in certain corner cases.
2249-
* _bt_checkkeys will stop the scan as soon as an equality qual fails (when
2250-
* its scan key was marked required), so _bt_first _must_ pass us an offnum
2251-
* exactly at the beginning of where equal tuples are to be found. When we're
2252-
* passed an offnum past the end of the page, we might still manage to stop
2253-
* the scan on this page by calling _bt_checkkeys against the high key. See
2254-
* _bt_readpage for full details.
2249+
* When we're passed an offnum past the end of the page, we might still manage
2250+
* to stop the scan on this page by calling _bt_checkkeys against the high
2251+
* key. See _bt_readpage for full details.
22552252
*
22562253
* On entry, so->currPos must be pinned and locked (so offnum stays valid).
22572254
* Parallel scan callers must have seized the scan before calling here.

src/backend/access/nbtree/nbtutils.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,11 +2969,6 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir,
29692969
* Tuple fails this qual. If it's a required qual for the current
29702970
* scan direction, then we can conclude no further tuples will
29712971
* pass, either.
2972-
*
2973-
* Note: because we stop the scan as soon as any required equality
2974-
* qual fails, it is critical that equality quals be used for the
2975-
* initial positioning in _bt_first() when they are available. See
2976-
* comments in _bt_first().
29772972
*/
29782973
if (requiredSameDir)
29792974
*continuescan = false;

0 commit comments

Comments
 (0)