Re: Bug in nbtree optimization to skip > operator comparisons (or < comparisons in backwards scans)
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Alexander Korotkov <aekorotkov@gmail.com>,
Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2023-12-06T16:44:16Z
Lists: pgsql-hackers
On Wed, Dec 6, 2023 at 5:27 AM Matthias van de Meent <boekewurm+postgres@gmail.com> wrote: > On Wed, 6 Dec 2023 at 14:11, Robert Haas <robertmhaas@gmail.com> wrote: > > It isn't very clear from the commit message that this commit is doing > > two different things, and in fact I'm still unclear on what exactly > > the other optimization is. > > I feel that Peter refered to these two distinct optimizations: Right. > 2. When scanning an index in ascending order using scankey a < 10 (one > that defines an endpoint of the scan), we can look ahead and check if > the last item on the page is consistent. If so, then all other items > on the page will also be consistent with that scankey. Also worth noting that it could be "scankey a = 10". That is, the precheck optimization (i.e. the optimization that's not the target of my test case) can deal with equalities and inequalities just as well (any scan key that's required in the current scan direction is supported). On the other hand the required-in-opposite-direction-only optimization (i.e. the target of my test case) only applies to inequality strategy scan keys. It kinda makes sense to explain both concepts using an example that involves both > and < strategy inequalities, since that makes the symmetry between the two optimizations clearer. -- Peter Geoghegan
Commits
-
Fix an oversight in refactoring in 06b10f80ba4.
- b670b93a66fc 17.0 landed
-
Make RangeTblEntry dump order consistent
- b4080fa3dcf6 17.0 cited
-
Improvements and fixes for e0b1ee17dc
- 7e6fb5da41d8 17.0 landed
-
Remove BTScanOpaqueData.firstPage
- 06b10f80ba4d 17.0 landed
-
Optimize nbtree backward scan boundary cases.
- c9c0589fda0e 17.0 cited
-
Skip checking of scan keys required for directional scan in B-tree
- e0b1ee17dc3a 17.0 cited