pgsql: Fix nbtree backward scan race condition comments.

2023-12-08 Thread Peter Geoghegan
Fix nbtree backward scan race condition comments. Remove comments that supposed that holding a pin was a useful interlock for _bt_walk_left(). There are times when _bt_walk_left() doesn't hold either a lock or a pin on any page, so clearly this can't be true. _bt_walk_left() is even prepared to

pgsql: Micro-optimize JSONTYPE_NUMERIC code path in json.c.

2023-12-08 Thread Nathan Bossart
Micro-optimize JSONTYPE_NUMERIC code path in json.c. This commit does the following: * In datum_to_json_internal(), the call to IsValidJsonNumber() is replaced with simplified validation code. This avoids an extra call to strlen() in this path, and it avoids validating the entire string

pgsql: Cache opaque handle for GUC option to avoid repeasted lookups.

2023-12-08 Thread Jeff Davis
Cache opaque handle for GUC option to avoid repeasted lookups. When setting GUCs from proconfig, performance is important, and hash lookups in the GUC table are significant. Per suggestion from Robert Haas. Discussion:

pgsql: Optimize nbtree backward scan boundary cases.

2023-12-08 Thread Peter Geoghegan
Optimize nbtree backward scan boundary cases. Teach _bt_binsrch (and related helper routines like _bt_search and _bt_compare) about the initial positioning requirements of backward scans. Routines like _bt_binsrch already know all about "nextkey" searches, so it seems natural to teach them about

pgsql: Allow parallel CREATE INDEX for BRIN indexes

2023-12-08 Thread Tomas Vondra
Allow parallel CREATE INDEX for BRIN indexes Allow using multiple worker processes to build BRIN index, which until now was supported only for BTREE indexes. For large tables this often results in significant speedup when the build is CPU-bound. The work is split in a simple way - each worker

pgsql: Add empty BRIN ranges during CREATE INDEX

2023-12-08 Thread Tomas Vondra
Add empty BRIN ranges during CREATE INDEX When building BRIN indexes, the brinbuildCallback only advances to the next page range when seeing a tuple that doesn't belong to the current one. This means that the index may end up missing ranges at the end of the table, if those pages do not contain

Re: pgsql: llvmjit: Use explicit LLVMContextRef for inlining

2023-12-08 Thread Daniel Gustafsson
> On 20 Nov 2023, at 22:53, Daniel Gustafsson wrote: > >> On 19 Nov 2023, at 21:08, Daniel Gustafsson wrote: > >> I'll have a look with fresh eyes in the morning, and hopefully it will be >> fixable. If it get's messy it's quite possible that skipping v12 is the best >> option. > > As an

pgsql: Don't clean initdb files on template creation failure

2023-12-08 Thread Daniel Gustafsson
Don't clean initdb files on template creation failure Commit 252dcb32397f6 introduced initdb template caching to speed up tests by re-using initdb output. The initdb command didn't however use the --no-clean option to preserve generated data in case initdb crashes unlike pg_regress which does do

pgsql: Remove some unnecessary #includes of postmaster/interrupt.h

2023-12-08 Thread Heikki Linnakangas
Remove some unnecessary #includes of postmaster/interrupt.h Commit 44fc6e259b removed a bunch of references to SignalHandlerForCrashExit, leaving these #includes unneeded. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/44913add91e789884e207f19c1d7ec067f23f6d5

pgsql: Test that it works to RESET an invalid reloption

2023-12-08 Thread Alvaro Herrera
Test that it works to RESET an invalid reloption This works today, and it's valuable to ensure it doesn't get broken if/when we get around to refactoring the implementation. Author: Nikolay Shaplov Discussion: https://postgr.es/m/4563991.km65PDbjlG@thinkpad-pgpro Branch -- master Details