pgsql: nbtree: Use only one notnullkey ScanKeyData.

2025-07-16 Thread Peter Geoghegan
l boundary keys to startKeys[]. Using INDEX_MAX_KEYS-many ScanKeyData entries was (at best) misleading. Author: Peter Geoghegan Reviewed-By: Mircea Cadariu Discussion: https://postgr.es/m/CAH2-Wzm=1kJMSZhhTLoM5BPbwQNWxUj-ynOEh=89ptdzavg...@mail.gmail.com Branch -- master Detail

pgsql: Update obsolete row compare preprocessing comments.

2025-07-02 Thread Peter Geoghegan
Update obsolete row compare preprocessing comments. Restore nbtree preprocessing comments describing how we mark nbtree row compare members required to how they were prior to 2016 bugfix commit a298a1e0. Oversight in commit bd3f59fd, which made nbtree preprocessing revert to the original 2006 rul

pgsql: Update obsolete row compare preprocessing comments.

2025-07-02 Thread Peter Geoghegan
Update obsolete row compare preprocessing comments. Restore nbtree preprocessing comments describing how we mark nbtree row compare members required to how they were prior to 2016 bugfix commit a298a1e0. Oversight in commit bd3f59fd, which made nbtree preprocessing revert to the original 2006 rul

pgsql: Make handling of redundant nbtree keys more robust.

2025-07-02 Thread Peter Geoghegan
ance_array_keys apply row compare keys to start and end scans. This fixes what was arguably an oversight in either commit 5f4d98d4 or commit 8a510275. Author: Peter Geoghegan Reviewed-By: Heikki Linnakangas Discussion: https://postgr.es/m/CAH2-Wz=ds4M+3NXMgwxYxqU8MULaLf696_v5g=9WNmWL2=u...@mail

pgsql: Make row compares robust during nbtree array scans.

2025-07-02 Thread Peter Geoghegan
ch a required member key to end the scan -- provided the key is marked required in the _current_ scan direction. This fixes what was arguably an oversight in either commit 5f4d98d4 or commit 8a510275. It is a direct follow-up to today's commit f09816a0. Author: Peter Geoghegan Reviewed-By: Heikk

pgsql: Make row compares robust during nbtree array scans.

2025-07-02 Thread Peter Geoghegan
ch a required member key to end the scan -- provided the key is marked required in the _current_ scan direction. This fixes what was arguably an oversight in either commit 5f4d98d4 or commit 8a510275. It is a direct follow-up to today's commit f09816a0. Author: Peter Geoghegan Reviewed-By: Heikk

pgsql: Make handling of redundant nbtree keys more robust.

2025-07-02 Thread Peter Geoghegan
ance_array_keys apply row compare keys to start and end scans. This fixes what was arguably an oversight in either commit 5f4d98d4 or commit 8a510275. Author: Peter Geoghegan Reviewed-By: Heikki Linnakangas Discussion: https://postgr.es/m/CAH2-Wz=ds4M+3NXMgwxYxqU8MULaLf696_v5g=9WNmWL2=u...@mail.g

pgsql: nbtree: _bt_readnextpage doesn't affect markPos.

2025-06-13 Thread Peter Geoghegan
nbtree: _bt_readnextpage doesn't affect markPos. _bt_readnextpage expects so->currPos.buf to be InvalidBuffer (and for the position's page to be unlocked) when called. However, it does not expect there to be no pins held on any page. In particular, so->markPos might hold a separate pin, both bef

pgsql: Revert "nbtree: Remove useless row compare arg."

2025-06-11 Thread Peter Geoghegan
Revert "nbtree: Remove useless row compare arg." This reverts commit 54c6ea8c81db718508eeea50991d3c1c5dff54a5. Further analysis has shown that the forcenonrequired row compare behavior is in fact necessary, despite the new restrictions on RowCompares imposed by _bt_set_startikey following commit

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d30f8b..

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d30f8b..

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d30f8b..

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d30f8b..

pgsql: Make _bt_killitems drop pins it acquired itself.

2025-06-11 Thread Peter Geoghegan
introduced by commit e6eed40e. That will make bugs of the same general nature as this one impossible (or make them much easier to detect, at least). Author: Peter Geoghegan Reported-By: Alexander Lakhin Discussion: https://postgr.es/m/545be1e5-3786-439a-9257-a90d30f8b..

pgsql: Avoid BufferGetLSNAtomic() calls during nbtree scans.

2025-06-06 Thread Peter Geoghegan
se checksums by default, so it seems prudent to address the problem now. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/941f0190-e3c6-4622-9ac7-c04e936e5...@vondra.me Discussion: https://postgr.es/m/CAH2-Wzk-Dg5XWs_jDuiHt4_7ryrSY+n=vxmhy51evqpdfsk...@mail.gm

pgsql: nbtree: Remove useless row compare arg.

2025-06-05 Thread Peter Geoghegan
nbtree: Remove useless row compare arg. Use of a RowCompare key makes nbtree index scans ineligible to use pstate.forcenonrequired following recent bugfix commit 5f4d98d4. There's no longer any need for _bt_check_rowcompare to accept a forcenonrequired argument, so remove it. Branch -- master

pgsql: Prevent premature nbtree array advancement.

2025-05-07 Thread Peter Geoghegan
its progress through the index's key space (at least when the scan is "between pages"). Oversight in commit 8a510275, which optimized nbtree search scan key comparisons. Author: Peter Geoghegan Reviewed-By: Mark Dilger Discussion: https://postgr.es/m/cah2-wzmodse+gptd1crgu9ez8ytyyd

pgsql: nbtree: tighten up array recheck rules.

2025-05-07 Thread Peter Geoghegan
us all the more reason to keep things simple and consistent. This was arguably an oversight in commit 9a2e2a285a, which improved nbtree array primitive scan scheduling. Author: Peter Geoghegan Discussion: https://postgr.es/m/cah2-wzkxzjajgyw-pcq7vadphat3huu+zw_j448rpcbesu2...@mail.gmail

pgsql: Avoid treating nonrequired nbtree keys as required.

2025-05-02 Thread Peter Geoghegan
alled when pstate.forcenonrequired). Oversight in commit 8a510275, which optimized nbtree search scan key comparisons. Author: Peter Geoghegan Reported-By: Mark Dilger Discussion: https://postgr.es/m/CAHgHdKsn2W=gpbmj7p6mjqfvxb+zzdbkwtsg0o3f5hh8rkr...@mail.gmail.com Discussion: https://postgr

pgsql: Adjust overstrong nbtree skip array assertion.

2025-04-30 Thread Peter Geoghegan
Adjust overstrong nbtree skip array assertion. Make an nbtree array preprocessing assertion account for scans that add fewer skip arrays than initially expected due to preprocessing finding an unsatisfiable array qual. Oversight in commit 92fe23d9. Author: Peter Geoghegan Reported-By: Mark

Re: pgsql: Improve nbtree skip scan primitive scan scheduling.

2025-04-30 Thread Peter Geoghegan
ng to talk about this on the main skip scan -hackers thread, when I have a proper fix. I already have a fix for the issue that you reported, but there seems to be an independent remaining issue with backwards scans that I haven't quite got to the bottom of just yet. Thanks -- Peter Geoghegan

pgsql: Fix obsolete nbtree array advancement comment.

2025-04-28 Thread Peter Geoghegan
Fix obsolete nbtree array advancement comment. Checking if another primitive scan is required after all once the next leaf page was moved from _bt_checkkeys to its _bt_readpage caller by commit 9a2e2a28. Update a comment that incorrectly described the recheck mechanism as something that takes pla

Re: pgsql: Improve nbtree skip scan primitive scan scheduling.

2025-04-28 Thread Peter Geoghegan
On Sun, Apr 27, 2025 at 1:06 PM Mark Dilger wrote: > I can confirm that your patch fixes the problem, having spent some four hours > trying to find other test cases which still fail, finding none. Great. I pushed essentially the same patch to HEAD just now. Thanks for the report! --

pgsql: Make NULL tuple values always advance skip arrays.

2025-04-28 Thread Peter Geoghegan
in commit 8a510275, which optimized nbtree search scan key comparisons with skip arrays. Author: Peter Geoghegan Reported-By: Mark Dilger Discussion: https://postgr.es/m/cahghdktlfwzcjr87hmh0hydhgcifu4tj7ihz-xh8qsjret5...@mail.gmail.com Branch -- master Details --- https://git.postgre

Re: clang-tidy complaints

2025-04-27 Thread Peter Geoghegan
mostly use clang-tidy through clangd). I'll try to remember to use it when I run clang-tidy a year from now, to clean up the master branch at the end of the Postgres 19 cycle. -- Peter Geoghegan

Re: pgsql: Improve nbtree skip scan primitive scan scheduling.

2025-04-26 Thread Peter Geoghegan
This looks to have been a silly oversight in our handling of NULL tuple datums within _bt_check_compare. Attached provisional fix makes your test case pass. -- Peter Geoghegan v1-0001-Provisional-fix.patch Description: Binary data

Re: clang-tidy complaints

2025-04-12 Thread Peter Geoghegan
On Sat, Apr 12, 2025 at 12:35 PM Tom Lane wrote: > Peter Geoghegan writes: > > The first such complaint concerns a new mcxt.c function parameter that > > shadows a global variable in the same file -- attached patch fixes > > that by renaming the function parameter. T

clang-tidy complaints

2025-04-12 Thread Peter Geoghegan
know enough to know if I should proceed here. I have not attached a fix for a similar vendored code issue that appears in timingsafe_bcmp.c, since that involved a declaration provided by my system's openSSL being inconsistent with our own vendored definition. A fix for that seemed unnecessary.

pgsql: Harmonize function parameter names for Postgres 18.

2025-04-12 Thread Peter Geoghegan
Harmonize function parameter names for Postgres 18. Make sure that function declarations use names that exactly match the corresponding names from function definitions in a few places. These inconsistencies were all introduced during Postgres 18 development. This commit was written with help fro

pgsql: Avoid extra index searches through preprocessing.

2025-04-04 Thread Peter Geoghegan
But the savings can really add up in cases where an affected skip array comes after some other array. For example, a scan indexqual "WHERE x IN (1, 2, 3) AND y > 5 AND z = 2" can save as many as 3 _bt_first calls by applying the new transformation to its "y" array (up to 1

pgsql: Improve nbtree skip scan primitive scan scheduling.

2025-04-04 Thread Peter Geoghegan
has already wasted noticeably-many cycles due to inefficient primitive scan scheduling). Follow-up to commits 92fe23d9 and 9a2e2a28. Author: Peter Geoghegan Reviewed-By: Matthias van de Meent Discussion: https://postgr.es/m/CAH2-Wz=rvdg3zwytfwbsyw7fwh7zvefvthed5jkesutt0rc...@mail.gmail.com

pgsql: Add nbtree skip scan optimization.

2025-04-04 Thread Peter Geoghegan
loss. As things stand, these assumptions are much too optimistic: skip array maintenance will lead to unacceptable regressions with unsympathetic queries (queries whose scan can't skip over many irrelevant leaf pages). An upcoming commit will address the problems in this area by enhancing _b

pgsql: Further optimize nbtree search scan key comparisons.

2025-04-04 Thread Peter Geoghegan
x scans that use a skip array. The underlying issue with such selective scans is that they never get as far as reading a second leaf page, and so will never get a chance to consider applying the "startikey" optimization. In principle, all regressions could be avoided by teaching preprocessing

pgsql: Improve nbtree array primitive scan scheduling.

2025-03-22 Thread Peter Geoghegan
dvance_array_keys). While the problems that this commit ameliorates are more likely with skip arrays (at least in practice), SAOP arrays (or those with very dense, contiguous array elements) are also affected. Author: Peter Geoghegan Reviewed-By: Matthias van de Meent Discussion: https://postg

Re: pgsql: Doc: silence A4 PDF build warnings.

2025-03-11 Thread Peter Geoghegan
On Tue, Mar 11, 2025 at 11:36 PM Tom Lane wrote: > Per buildfarm. What buildfarm animal? I didn't see anything about this today. Thanks, though. -- Peter Geoghegan

pgsql: nbtree: Make BTMaxItemSize into object-like macro.

2025-03-11 Thread Peter Geoghegan
paration for an upcoming patch that adds skip scan to nbtree. Parallel index scans that use skip scan will serialize datums (not just SAOP array subscripts) when scheduling primitive scans. BTMaxItemSize will be used by btestimateparallelscan to determine how much DSM to request. Author: Peter

pgsql: Show index search count in EXPLAIN ANALYZE, take 2.

2025-03-11 Thread Peter Geoghegan
r per amgetbitmap call). But it is also necessary for the executor proper to manage the shared memory now used to transfer each worker's counter struct to the leader. Author: Peter Geoghegan Reviewed-By: Robert Haas Reviewed-By: Tomas Vondra Reviewed-By: Masahiro Ikeda Reviewed-By: Matth

pgsql: Make parallel nbtree index scans use an LWLock.

2025-03-08 Thread Peter Geoghegan
nally allocate memory while the scan descriptor is locked, while copying datums that were serialized by another backend. Author: Peter Geoghegan Reviewed-By: Matthias van de Meent Discussion: https://postgr.es/m/CAH2-Wz=PKR6rB7qbx+Vnd7eqeB5VTcrW=ijvastskbdg+kw...@mail.gmail.com Branch -- m

pgsql: nbtree: refine _bt_readnextpage contract comments.

2025-03-07 Thread Peter Geoghegan
nbtree: refine _bt_readnextpage contract comments. Another minor follow-up commit for commit 1bd4bc85, which changed the _bt_readnextpage contract. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8e167e618893b59ee45317c43055002ba71f955b Modified Files -

pgsql: Revert "Show index search count in EXPLAIN ANALYZE."

2025-03-05 Thread Peter Geoghegan
Revert "Show index search count in EXPLAIN ANALYZE." This reverts commit 5ead85fbc81162ab1594f656b036a22e814f96b3. This commit shows test failures with debug_parallel_query=regress. The underlying issue needs to be debugged, so revert for now. Branch -- master Details --- https://git.p

Re: pgsql: Show index search count in EXPLAIN ANALYZE.

2025-03-05 Thread Peter Geoghegan
On Wed, Mar 5, 2025 at 9:37 AM Peter Geoghegan wrote: > Show index search count in EXPLAIN ANALYZE. I'm aware of the fact that there are currently buildfarm failures due to test flappiness. I'll work to fix the issues today. If I am unable to find a resolution within a few hou

pgsql: Show index search count in EXPLAIN ANALYZE.

2025-03-05 Thread Peter Geoghegan
multiple times during a single amgettuple call (or amgetbitmap call), and directly exposing PlanState.instrument to index access methods seems unappealing. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Reviewed-By: Robert Haas Reviewed-By: Masahiro Ikeda Reviewed-By: Matthias van de Meent D

pgsql: Fix nbtree contradictory array element comment.

2025-01-16 Thread Peter Geoghegan
Fix nbtree contradictory array element comment. Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/901bd4a65ab9bc0025be0fc8fe1fce3c69e7b78e Modified Files -- src/backend/access/nb

pgsql: Add BTOPTIONS_PROC comments to nbtree.h.

2025-01-13 Thread Peter Geoghegan
Add BTOPTIONS_PROC comments to nbtree.h. Add comments explaining the purpose of B-Tree support function 5 to nbtree.h for consistency (all other support functions were already described by nearby comments). This fixes what was arguably an oversight in commit 911e702077, or in follow-up doc commit

pgsql: Move nbtree preprocessing into new .c file.

2025-01-13 Thread Peter Geoghegan
strictly mechanical. Author: Peter Geoghegan Suggested-by: Heikki Linnakangas Discussion: https://postgr.es/m/CAH2-WznwNn1BDOpWxHBUK1f3Rdw8pO9UCenWXnvT=n9go8g...@mail.gmail.com Discussion: https://postgr.es/m/86930045-5df5-494a-b4f1-815bc3fbcce0%40iki.fi Branch -- master Details

pgsql: Fix obsolete nbtree README left link remarks.

2025-01-10 Thread Peter Geoghegan
Fix obsolete nbtree README left link remarks. Oversight in commit 1bd4bc85, which made nbtree backwards scans operate off of a copy of each page's left link as of the time of its call to _bt_readpage. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5b14ec0a48cca3add

pgsql: Improve nbtree unsatisfiable RowCompare detection.

2025-01-07 Thread Peter Geoghegan
full index scans that cannot possibly return any matching rows. Author: Peter Geoghegan Reviewed-By: Matthias van de Meent Discussion: https://postgr.es/m/CAH2-WzmySVXst2hFrOATC-zw1Byg1XC-jYUS314=mzuqsnw...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: nbtree: Simplify _bt_first parallel scan handling.

2025-01-07 Thread Peter Geoghegan
nbtree: Simplify _bt_first parallel scan handling. This new structure relieves _bt_first from having separate calls to _bt_start_array_keys for the serial case and parallel case. This saves code, and seems clearer. Follow-up to work from commits 4e6e375b and b5ee4e52. Author: Peter Geoghegan

pgsql: Fix nbtree symbol name comment reference.

2024-12-24 Thread Peter Geoghegan
Fix nbtree symbol name comment reference. Oversight in commit 5bf748b86b. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9b254895c367a3b962bcdd3e35f8590005106e8a Modified Files -- src/backend/access/nbtree/nbtsearch.c | 4 ++-- 1 file changed, 2 inserti

pgsql: Reset btpo_cycleid in nbtree VACUUM's REDO routine.

2024-12-23 Thread Peter Geoghegan
l save work later on, after standby promotion: subsequent VACUUMs won't need to clear btpo_cycleid using the hint-like update mechanism as often as they otherwise would. Author: Peter Geoghegan Reviewed-By: Andrey Borodin Discussion: https://postgr.es/m/CAH2-Wz=+ldfxn9nzyesco8ifcykt6+n-vlyygyse

pgsql: Avoid nbtree index scan SAOP scanBehind confusion.

2024-12-19 Thread Peter Geoghegan
f the next page). _bt_advance_array_keys would return false for the tuple, ultimately resulting in _bt_checkkeys failing to return a matching tuple. Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Discussion: https://postgr.es/m/cah2-wzkjkncfqyauteu

pgsql: Avoid nbtree index scan SAOP scanBehind confusion.

2024-12-19 Thread Peter Geoghegan
f the next page). _bt_advance_array_keys would return false for the tuple, ultimately resulting in _bt_checkkeys failing to return a matching tuple. Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Discussion: https://postgr.es/m/cah2-wzkjkncfqyauteu

Re: pgsql: Enable BUFFERS with EXPLAIN ANALYZE by default

2024-12-11 Thread Peter Geoghegan
org/highlights/all.html. It looks like the pg_stat_statements test is the only regression seen on CI. Note that this includes test runs that took place with all of the current cleanup commits that were pushed so far, so I'm confident that this still needs to be fixed. -- Peter Geoghegan diff -

pgsql: Refine nbtree = redundancy preprocessing comment.

2024-11-20 Thread Peter Geoghegan
Refine nbtree = redundancy preprocessing comment. Spell out how a = key associated with a SAOP array renders a > key against the same index column redundant at the relevant point inside _bt_preprocess_keys. Follow-up to commit 5bf748b8. Branch -- master Details --- https://git.postgresq

pgsql: nbtree: consistently use minoff variable.

2024-11-18 Thread Peter Geoghegan
nbtree: consistently use minoff variable. This was arguably an oversight in commit 29b64d1de7, which moved this code from nbtutils.c to its nbtsearch.c caller. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/18ea6b3d0da357b5874ab9cf41350d4473b01ee9 Modified Files -

pgsql: Add nbtree amgettuple return item function.

2024-11-13 Thread Peter Geoghegan
Add nbtree amgettuple return item function. This makes it easier to add precondition assertions. We now assert that the last call to _bt_readpage succeeded, and that the current item index is within the bounds of the currPos items array. Author: Peter Geoghegan Reviewed-By: Masahiro Ikeda

pgsql: Fix obsolete nbtree page reuse FSM comment.

2024-11-12 Thread Peter Geoghegan
Fix obsolete nbtree page reuse FSM comment. Oversight in commit d088ba5a. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3be30d007514d504b1d0554a20527ee5ba7a6cfb Modified Files -- src/backend/access/nbtree/nbtxlog.c | 6 +++--- 1 file changed, 3 inserti

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Count contrib/bloom index scans in pgstat view.

2024-11-12 Thread Peter Geoghegan
Count contrib/bloom index scans in pgstat view. Maintain the pg_stat_user_indexes.idx_scan pgstat counter during contrib/Bloom index scans. Oversight in commit 9ee014fc, which added the Bloom index contrib module. Author: Masahiro Ikeda Reviewed-By: Peter Geoghegan Discussion: https

pgsql: Assert consistency of currPage that ended scan.

2024-11-08 Thread Peter Geoghegan
Assert consistency of currPage that ended scan. When _bt_readnextpage is called with our nbtree parallel scan already seized (i.e. when it is directly called by _bt_first), we never expect a prior call to _bt_readpage for lastcurrblkno to already indicate that the scan should end -- the _bt_first

pgsql: Avoid nbtree parallel scan currPos confusion.

2024-11-08 Thread Peter Geoghegan
izing nbtree backward scan locking). Author: Peter Geoghegan Reported-By: Masahiro Ikeda Diagnosed-By: Masahiro Ikeda Reviewed-By: Masahiro Ikeda Discussion: https://postgr.es/m/f8efb9c0f8d1a71b44fd7f8e42e49...@oss.nttdata.com Branch -- master Details --- https:

pgsql: Fix obsolete _bt_first comments.

2024-11-04 Thread Peter Geoghegan
Fix obsolete _bt_first comments. _bt_first doesn't necessarily hold onto a buffer pin on success exit. Fix header comments that claimed that we'll always hold onto a pin. Oversight in commit 2ed5b87f96. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/846cfe0dcc0281

pgsql: nbtree: Remove useless 'strat' local variable.

2024-11-04 Thread Peter Geoghegan
#x27; and 'backward' fields will be initialized the same way regardless. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/CAH2-Wz=PKR6rB7qbx+Vnd7eqeB5VTcrW=ijvastskbdg+kw...@mail.gmail.com Branch -- master Details --- https://git.postgresql.o

pgsql: Clarify nbtree parallel scan _bt_endpoint contract.

2024-11-04 Thread Peter Geoghegan
Clarify nbtree parallel scan _bt_endpoint contract. _bt_endpoint is a helper function for _bt_first that's called whenever no useful insertion scan key can be used, and we need to lock and read either the leftmost or rightmost leaf page in the index. Simplify and document its preconditions, relie

pgsql: Clarify nbtree array preprocessing comment.

2024-11-01 Thread Peter Geoghegan
Clarify nbtree array preprocessing comment. Oversight in commit 5bf748b8. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fc7ddededb9ee466d20581b966e01a3566b9559f Modified Files -- src/backend/access/nbtree/nbtutils.c | 5 +++-- 1 file changed, 3 inserti

pgsql: nbtree: assert no scheduled primscan between pages.

2024-10-30 Thread Peter Geoghegan
nbtree: assert no scheduled primscan between pages. Follow-up to bugfix commit 763d65ae. Technically this new assertion is redundant with the assertion recently added to _bt_readpage by that same commit, but it seems like a good idea to have both. The new assertion makes it clear that we expect

pgsql: Clarify nbtree array exhaustion comments.

2024-10-30 Thread Peter Geoghegan
Clarify nbtree array exhaustion comments. Strictly speaking, we only need to make sure to leave the scan's array keys in their final positions (final for the current scan direction) to handle SAOP array exhaustion because btgettuple might only return a subset of the items for the final page (final

pgsql: Fix bug in nbtree array primitive scan scheduling.

2024-10-30 Thread Peter Geoghegan
nced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wznv49bFsE2jkt4GuZ0tU2C91dEST=50egzjy2feoch...@mail.gmail.com Backpatch: 17-, where commit 5bf748b8 first appears. Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c1777

pgsql: Fix bug in nbtree array primitive scan scheduling.

2024-10-30 Thread Peter Geoghegan
nced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-Wznv49bFsE2jkt4GuZ0tU2C91dEST=50egzjy2feoch...@mail.gmail.com Backpatch: 17-, where commit 5bf748b8 first appears. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/763d6

pgsql: nbtree: Minor sibling link traversal tweaks.

2024-10-28 Thread Peter Geoghegan
nbtree: Minor sibling link traversal tweaks. Tweak some code comments for clarity, and relocate some local variable declarations to the scope where they're actually used. Follow-up to recent commit 1bd4bc85. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/123474cbc

Re: pgsql: Remove unused #include's from contrib, pl, test .c files

2024-10-28 Thread Peter Geoghegan
On Mon, Oct 28, 2024 at 11:48 AM Peter Geoghegan wrote: > This broke WAL_DEBUG builds, which rely on TopMemoryContext within xlog.c. Minor correction: it was actually commit e18512c0, not this similar commit. -- Peter Geoghegan

Re: pgsql: Remove unused #include's from contrib, pl, test .c files

2024-10-28 Thread Peter Geoghegan
On Mon, Oct 28, 2024 at 3:03 AM Peter Eisentraut wrote: > Remove unused #include's from contrib, pl, test .c files This broke WAL_DEBUG builds, which rely on TopMemoryContext within xlog.c. -- Peter Geoghegan

pgsql: Fix obsolete nbtree split buffer comment.

2024-10-27 Thread Peter Geoghegan
Fix obsolete nbtree split buffer comment. Oversight in commit d088ba5a. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/33b2fbe0504bd349c3bb86e8711f5531c8ca84b7 Modified Files -- src/backend/access/nbtree/nbtinsert.c | 2 +- 1 file changed, 1 insertion(+

pgsql: Optimize nbtree backwards scans.

2024-10-18 Thread Peter Geoghegan
upersedes the one recently added by commit 3f44959f. Author: Matthias van de Meent Author: Peter Geoghegan Discussion: https://postgr.es/m/caeze2wgpbgrgttxtwvpxc9+pb6fc1a7t+vygxhzfnrfxcqv...@mail.gmail.com Discussion: https://postgr.es/m/CAH2-WzkBTuFv7W2+84jJT8mWZLXVL0GHq2hMUTn6c9Vw=ey...@m

pgsql: nbtree: fix read page recheck typo.

2024-10-16 Thread Peter Geoghegan
nbtree: fix read page recheck typo. Oversight in commit 79fa7b3b. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c0490b0ef773d8694d1a9bfbf4116a102c07458d Modified Files -- src/backend/access/nbtree/nbtsearch.c | 2 +- 1 file changed, 1 insertion(+), 1 d

pgsql: Normalize nbtree truncated high key array behavior.

2024-10-16 Thread Peter Geoghegan
re sensitive to any implementation deficiencies in this area. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/CAH2-Wz=9A_UtM7HzUThSkQ+BcrQsQZuNhWOvQWK06PRkEp=s...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/79fa7b

pgsql: Update obsolete nbtree array preprocessing comments.

2024-09-24 Thread Peter Geoghegan
Update obsolete nbtree array preprocessing comments. The array->scan_key references fixed up at the end of preprocessing start out as offsets into the arrayKeyData[] array (the array returned by _bt_preprocess_array_keys at the start of preprocessing that involves array scan keys). Offsets into t

Re: pgsql: Allow meson builds to run test_pg_dump test in installcheck mode

2024-09-24 Thread Peter Geoghegan
On Mon, Sep 23, 2024 at 11:40 PM Michael Paquier wrote: > Allow meson builds to run test_pg_dump test in installcheck mode. This commit has Tom as the git author, and Michael as the git committer. Was that intentional? -- Peter Geoghegan

pgsql: Refactor handling of nbtree array redundancies.

2024-09-21 Thread Peter Geoghegan
scan optimizations to nbtree will take advantage of this. In passing, remove and rename certain _bt_preprocess_keys variables to make the difference between our input scan key array and our output scan key array clearer. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https

pgsql: Fix nbtree pgstats accounting with parallel scans.

2024-09-20 Thread Peter Geoghegan
sight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/CAH2-Wz=e7xrkvscbn0u6v81nk3q-dqomivvbesjg-zwefdd...@mail.gmail.com Discussion: https://postgr.es/m/cah2-wzkrqvaqr2ctnqtzp0z6ful4-3ed

pgsql: Fix nbtree pgstats accounting with parallel scans.

2024-09-20 Thread Peter Geoghegan
sight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/CAH2-Wz=e7xrkvscbn0u6v81nk3q-dqomivvbesjg-zwefdd...@mail.gmail.com Discussion: https://postgr.es/m/cah2-wzkrqvaqr2ctnqtzp0z6ful4-3ed

pgsql: Avoid parallel nbtree index scan hangs with SAOPs.

2024-09-17 Thread Peter Geoghegan
ted-By: Tomas Vondra Reviewed-By: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-WzmMGaPa32u9x_FvEbPTUkP5e95i=qxr8054nvcrydp...@mail.gmail.com Backpatch: 17-, where nbtree SAOP execution was enhanced. Branch -- master Details --- https://git.postgres

pgsql: Avoid parallel nbtree index scan hangs with SAOPs.

2024-09-17 Thread Peter Geoghegan
ted-By: Tomas Vondra Reviewed-By: Peter Geoghegan Discussion: https://postgr.es/m/CAH2-WzmMGaPa32u9x_FvEbPTUkP5e95i=qxr8054nvcrydp...@mail.gmail.com Backpatch: 17-, where nbtree SAOP execution was enhanced. Branch -- REL_17_STABLE Details --- https://git.postgres

pgsql: Fix nbtree lookahead overflow bug.

2024-08-26 Thread Peter Geoghegan
Fix nbtree lookahead overflow bug. Add bounds checking to nbtree's lookahead/skip-within-a-page mechanism. Otherwise it's possible for cases with lots of before-array-keys tuples to overflow an int16 variable, causing the mechanism to generate an out of bounds page offset number. Oversight in com

pgsql: Fix nbtree lookahead overflow bug.

2024-08-26 Thread Peter Geoghegan
Fix nbtree lookahead overflow bug. Add bounds checking to nbtree's lookahead/skip-within-a-page mechanism. Otherwise it's possible for cases with lots of before-array-keys tuples to overflow an int16 variable, causing the mechanism to generate an out of bounds page offset number. Oversight in com

pgsql: Give nbtree move right function internal linkage.

2024-08-12 Thread Peter Geoghegan
Give nbtree move right function internal linkage. Declare _bt_moveright() static. This is a minor modularity win; the routine was already private to nbtsearch.c for all practical purposes. Author: Matthias van de Meent Discussion: https://postgr.es/m/caeze2wgwvzcnexqb_op5mmzmdgj3fg3ahvm6bq2izp

pgsql: Avoid unneeded nbtree backwards scan buffer locks.

2024-08-11 Thread Peter Geoghegan
x27;t care about our original page's left link. Author: Peter Geoghegan Reviewed-By: Matthias van de Meent Discussion: https://postgr.es/m/CAH2-Wz=xgs7PojG=euvhgadwenzu_my_rinh-w9wfpsas71...@mail.gmail.com Branch -- master Details --- https://git.pos

pgsql: Fix nbtree array unsatisfied inequality check.

2024-06-26 Thread Peter Geoghegan
Fix nbtree array unsatisfied inequality check. _bt_advance_array_keys didn't take sufficient care at the point where it decides whether to start a new primitive index scan based on a call to _bt_check_compare against finaltup (a call with the scan direction flipped around). The final decision was

pgsql: Harmonize pg_bsd_indent parameter names.

2024-06-12 Thread Peter Geoghegan
Harmonize pg_bsd_indent parameter names. Make sure that function declarations use names that exactly match the corresponding names from function definitions in pg_bsd_indent. This commit was written with help from clang-tidy, by mechanically applying the same rules as similar clean-up commits. D

pgsql: Harmonize function parameter names for Postgres 17.

2024-06-12 Thread Peter Geoghegan
Harmonize function parameter names for Postgres 17. Make sure that function declarations use names that exactly match the corresponding names from function definitions in a few places. These inconsistencies were all introduced during Postgres 17 development. pg_bsd_indent still has a couple of s

pgsql: Remove unneeded nbtree array preprocessing assert.

2024-04-22 Thread Peter Geoghegan
Remove unneeded nbtree array preprocessing assert. Certain cases involving the use of cursors had assertion failures within _bt_preprocess_keys's recently added no-op return path. The assertion in question made the faulty assumption that a second or third call to _bt_preprocess_keys (within the s

pgsql: Remove overzealous array element type assertion.

2024-04-21 Thread Peter Geoghegan
Remove overzealous array element type assertion. This led to spurious assertion failures in certain scenarios involving pseudo types. Oversight in commit 5bf748b8, which enhanced nbtree ScalarArrayOp execution. Reported-By: Richard Guo Discussion: https://postgr.es/m/cambws48f5rdowxat76zd40m7n

pgsql: Don't try to fix eliminated nbtree array scan keys.

2024-04-18 Thread Peter Geoghegan
Don't try to fix eliminated nbtree array scan keys. Preprocessing for nbtree index scans allowed array "input" scan keys already marked eliminated during array-specific preprocessing to be "fixed up" during preprocessing proper. This allowed eliminated scan keys on DESC index columns to spurious

pgsql: Fix nbtree "deduce NOT NULL" scan key comment.

2024-04-16 Thread Peter Geoghegan
Fix nbtree "deduce NOT NULL" scan key comment. Oversight in commit c9c0589fda. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c62d2ebd9e6f94758f5ed3a28cf08861229ae421 Modified Files -- src/backend/access/nbtree/nbtsearch.c | 2 +- 1 file changed, 1 inse

pgsql: Fix nbtree posting list comment.

2024-04-16 Thread Peter Geoghegan
Fix nbtree posting list comment. Oversight in commit 0d861bbb70. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f6987041557f2b2b96f116c1f3150f9ed9a77c89 Modified Files -- src/include/access/nbtree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

  1   2   3   4   5   6   7   8   9   >