Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options

2025-08-16 Thread Michael Paquier
On Sun, Aug 17, 2025 at 03:54:16PM +0900, Michael Paquier wrote: > Side thing.. I'm wondering what prevents us from wiping out entirely > the use of long in this file. long is 8 bytes everywhere, except on > WIN32 where it's 4 bytes (as you say), which is a bad practice as we > have been bitten b

Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options

2025-08-16 Thread Michael Paquier
On Sun, Aug 17, 2025 at 12:24:29AM +1200, David Rowley wrote: > I noticed that the existing code has a set of global variables that > keeps track of accesses, collisions and expansions for *all* tables in > the backend. This didn't fit well with the single line elog. I kinda > though the global inf

Re: Remove Instruction Synchronization Barrier in spin_delay() for ARM64 architecture

2025-08-16 Thread Michael Paquier
On Fri, Aug 15, 2025 at 03:54:29PM -0500, Nathan Bossart wrote: > On Fri, Aug 15, 2025 at 03:25:20PM -0500, Nathan Bossart wrote: >> On Fri, Aug 15, 2025 at 04:13:30PM -0400, Andres Freund wrote: >>> IMO, the only way to actually make pg_stat_statements scale is to move to a >>> model much more lik

Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring

2025-08-16 Thread Naga Appani
Hi Michael, Ashutosh, Thanks a lot for the detailed reviews and feedback. Please find attached v4 of the patchset. Summary of changes in v4: - Split into two patches as suggested: 1. Expose and rename ReadMultiXactCounts() -> GetMultiXactInfo() in multixact.h with clearer comments. 2. Add pg_

Re: Dead code with short varlenas in toast_save_datum()

2025-08-16 Thread Michael Paquier
On Sat, Aug 16, 2025 at 02:34:02AM -0700, Nikhil Kumar Veldanda wrote: > Thanks for the guidance. I’ve updated the isolation test to use a CTAS > capturing (id, chunk_id) pre-CLUSTER and added a post-CLUSTER join to > verify the chunk IDs match. I also reduced the number of tuples to 1. > > Please

Re: [PATCH] Let's get rid of the freelist and the buffer_strategy_lock

2025-08-16 Thread Thomas Munro
On Sun, Aug 17, 2025 at 4:34 PM Thomas Munro wrote: > Or if you don't like those odds, maybe it'd be OK to keep % but use it > rarely and without the CAS that can fail. ... or if we wanted to try harder to avoid %, could we relegate it to the unlikely CLOCK-went-all-the-way-around-again-due-to-un

Re: someone else to do the list of acknowledgments

2025-08-16 Thread Corey Huinker
On Sat, Aug 16, 2025 at 11:58 PM jian he wrote: > hi. > maybe we should start working on this? > > https://www.postgresql.org/developer/roadmap > says 18 will be released in September 2025. I am.

Re: [PATCH] Let's get rid of the freelist and the buffer_strategy_lock

2025-08-16 Thread Thomas Munro
On Sat, Aug 16, 2025 at 3:37 PM Thomas Munro wrote: > while (hand >= NBuffers) > { > /* Base value advanced by backend that overshoots by one tick. */ > if (hand == NBuffers) > pg_atomic_fetch_add_u64(&StrategyControl->ticks_base, NBuffers); > hand -= NB

Re: someone else to do the list of acknowledgments

2025-08-16 Thread jian he
hi. maybe we should start working on this? https://www.postgresql.org/developer/roadmap says 18 will be released in September 2025.

Re: Improve LWLock tranche name visibility across backends

2025-08-16 Thread Sami Imseih
>> See v7. I fixed an earlier issue with Windows, which was due to not initializing the shared memory inside ``` #ifdef EXEC_BACKEND extern void AttachSharedMemoryStructs(void); #endif ``` But then I found another one after. LWLockTrancheNames gets forked on Linux, but of course that will not ha

Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)

2025-08-16 Thread Kirk Wolak
On Fri, Aug 15, 2025 at 1:25 PM Greg Sabino Mullane wrote: > I've seen this idea pop up over the years, and it's still a good one. > Rather than invent new flags, I think a better approach would be to > convince pg_dump to dump a view, such that table foo has a view fooslice to > limit / filter t

Re: PoC: pg_dump --filter-data (like Oracle Where Clause on RMAN for specific tables)

2025-08-16 Thread Kirk Wolak
On Fri, Aug 15, 2025 at 12:37 PM Tom Lane wrote: > Kirk Wolak writes: > > We have a handful of tables that have 90% of the data going back 30 > years. > > We NEVER restore this data to Dev or Staging. We used a special RMAN > > backup where these tables had a "WHERE clause" applied to them du

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-08-16 Thread Tatsuo Ishii
>> Attached are the v18 patches for adding RESPECT/IGNORE NULLS options >> to some window functions. Recent changes to doc/src/sgml/func.sgml >> required v17 to be rebased. Other than that, nothing has been changed. >> >> Oliver, do you have any comments on the patches? >> > > Looks good, tried it

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-08-16 Thread Oliver Ford
On Sat, Aug 16, 2025 at 10:33 AM Tatsuo Ishii wrote: > Attached are the v18 patches for adding RESPECT/IGNORE NULLS options > to some window functions. Recent changes to doc/src/sgml/func.sgml > required v17 to be rebased. Other than that, nothing has been changed. > > Oliver, do you have any com

Re: BackgroundPsql swallowing errors on windows

2025-08-16 Thread Tom Lane
Noah Misch writes: > On Sun, Aug 10, 2025 at 03:07:43PM -0400, Tom Lane wrote: >> That's great news, but apparently there is some lag in new packages >> actually becoming available for download: > Hmm. I've never used MacPorts, so I'll probably not be an informed > commentator on its release flo

Re: BackgroundPsql swallowing errors on windows

2025-08-16 Thread Noah Misch
On Sun, Aug 10, 2025 at 03:07:43PM -0400, Tom Lane wrote: > Noah Misch writes: > > On Sun, Mar 09, 2025 at 10:23:55AM -0700, Noah Misch wrote: > >> Yep. I put the tree in the necessary state, and [...] > > > https://metacpan.org/dist/IPC-Run is now a fresh release, and > > https://ports.macports

Re: About Custom Aggregates, C Extensions and Memory

2025-08-16 Thread Tom Lane
Marthin Laubscher writes: > I was fixing on (ab)using user-defined aggregates for a concept that would, > on second thought, be better described as a key-only table persisted and > manipulated as a single opaque value that is only ever expanded to a > table/set/collection in memory. Initial foc

Re: Improve LWLock tranche name visibility across backends

2025-08-16 Thread Sami Imseih
> So we could do something like: > > int i = 0; > while (i < LWLockTrancheNames.shmem->allocated && >!DsaPointerIsValid(shared_ptrs[i])) > { > i++; > } I found a different approach without tracking an additional counter. Then sync stops when an invalid pointer is found after at

Re: About Custom Aggregates, C Extensions and Memory

2025-08-16 Thread Marthin Laubscher
Tom Lane < t...@sss.pgh.pa.us> writes: > Yeah. What you want is to declare the aggregate as having transtype > "internal" (which basically means that ExecAgg will store a pointer > for you) and make that pointer point to a data structure kept in the > "aggcontext", which will have a suitable lifes

Re: Retail DDL

2025-08-16 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > On 2025-Aug-16, Kirill Reshke wrote: >> After putting some more thought into it, maybe we can implement the >> whole thing as contrib extension? This would be the most Postgres-y >> way to me. > If we do that, then core tools such as psql or pg_dump can n

Re: `pg_ctl init` crashes when run concurrently; semget(2) suspected

2025-08-16 Thread Greg Burd
> On Aug 15, 2025, at 10:25 PM, Thomas Munro wrote: > > On Sat, Aug 16, 2025 at 5:58 AM Burd, Greg wrote: >>> 1. They use CAS in sem_post() because they want to report EOVERFLOW if >>> you exceed SEM_VALUE_MAX, but POSIX doesn't seem to require that, so I >>> just used fetch-and-add. Is that

Re: Adding REPACK [concurrently]

2025-08-16 Thread Robert Treat
On Tue, Aug 5, 2025 at 4:59 AM Antonin Houska wrote: > > Alvaro Herrera wrote: > > > I made a few changes from Antonin's original at [2]. First, I modified > > the grammar to support "REPACK [tab] USING INDEX" without specifying the > > index name. With this change, all possibilities of the old

Re: Retail DDL

2025-08-16 Thread Álvaro Herrera
Hello Ziga, On 2025-Aug-14, Ziga wrote: > Of particular note is using oids only (no classid) to specify objects. I > used believe that oid are unique across a postgres database for catalog > objects, but since postgres 14 this no longer the case, see: > https://github.com/lacanoid/pgddl/issues/25

Re: Retail DDL

2025-08-16 Thread Álvaro Herrera
On 2025-Aug-16, Kirill Reshke wrote: > After putting some more thought into it, maybe we can implement the > whole thing as contrib extension? This would be the most Postgres-y > way to me. If we do that, then core tools such as psql or pg_dump can never depend on them. -1 from me. -- Álvaro H

Re: Compilation issues for HASH_STATISTICS and HASH_DEBUG options

2025-08-16 Thread David Rowley
On Sat, 16 Aug 2025 at 03:16, Tom Lane wrote: > * Neither printout identifies which hashtable it's talking about > in any usable fashion, which is silly when we could print > hashp->tabname. HASH_DEBUG prints the pointer to the table, > which is certainly useless unless you've got gdb attached to

Re: DSA overflow in hash join

2025-08-16 Thread Konstantin Knizhnik
Thank you for review! On 14/08/2025 10:34 PM, Heikki Linnakangas wrote: On 31/07/2025 18:13, Konstantin Knizhnik wrote: On 27/07/2025 8:24 PM, Konstantin Knizhnik wrote: I still trying to understand the reason of DSA overflow in hash join. In addition to two suspicious places where number of

Re: Dead code with short varlenas in toast_save_datum()

2025-08-16 Thread Nikhil Kumar Veldanda
On Thu, Aug 14, 2025 at 8:32 PM Michael Paquier wrote: > > > First, in the SQL test. The trick where you are using a PLAIN storage > to not allocate a chunk_id on initial storage with a value large > enough to force TOAST on rewrite, while the value is small enough to > fit on a single page, is a

Re: Retail DDL

2025-08-16 Thread Kirill Reshke
On Sat, 16 Aug 2025 at 10:08, I wrote: > On Thu, 14 Aug 2025 at 23:30, Andrew Dunstan wrote: > > Builtin > > functions are also likely to be faster. > > We are not actually aiming for speed here, aren’t we? I want to clarify here: I do not think consuming limiter resources of catalog OID for buil

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2025-08-16 Thread Tatsuo Ishii
Attached are the v18 patches for adding RESPECT/IGNORE NULLS options to some window functions. Recent changes to doc/src/sgml/func.sgml required v17 to be rebased. Other than that, nothing has been changed. Oliver, do you have any comments on the patches? > Attached are the v17 patches for adding

Re: Logical Replication of sequences

2025-08-16 Thread Masahiko Sawada
Hi, On Wed, Aug 13, 2025 at 3:57 AM vignesh C wrote: > > On Wed, 6 Aug 2025 at 16:29, shveta malik wrote: > > > > On Wed, Aug 6, 2025 at 2:28 PM vignesh C wrote: > > > > > > The attached v20250806 version patch has the changes for the same. > > > > > > > Thank You for the patches. Please find a

Re: Fix typos in comments in worker.c and execReplication.c

2025-08-16 Thread Masahiko Sawada
On Sat, Aug 16, 2025 at 12:44 AM Tender Wang wrote: > > Hi, > > While debugging the code, I found typos in worker.c and execReplication.c > > "suffcient" should be "sufficient" > "confict" should be "conflict" > > fd5a1a0 introduced these typos. > Please take a look at the attached patch. Than

Fix typos in comments in worker.c and execReplication.c

2025-08-16 Thread Tender Wang
Hi, While debugging the code, I found typos in worker.c and execReplication.c "suffcient" should be "sufficient" "confict" should be "conflict" fd5a1a0 introduced these typos. Please take a look at the attached patch. -- Thanks, Tender Wang From 6b40fae3d09755d497e79ce3895308e44fd6c9fb Mon S