RE: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-10-26 Thread Hayato Kuroda (Fujitsu)
Dear Sawada-san, > > Why can't we avoid counting invalid slots? I think this needs more > > comments. BTW, shouldn't this patch consider changing > > effective_wal_level when the last logical slot is invalidated? > > Ideally, when logical decoding is not possible in the system, then we > > can red

Re: Logical Replication of sequences

2025-10-26 Thread vignesh C
On Mon, 27 Oct 2025 at 10:04, Dilip Kumar wrote: > > On Mon, Oct 27, 2025 at 8:23 AM Zhijie Hou (Fujitsu) > wrote: >> >> On Friday, October 24, 2025 11:22 PM vignesh C wrote: >> > >> > On Thu, 23 Oct 2025 at 16:47, Amit Kapila wrote: >> > > >> > > On Thu, Oct 23, 2025 at 11:45 AM vignesh C wr

Re: Logical Replication of sequences

2025-10-26 Thread Dilip Kumar
On Mon, Oct 27, 2025 at 10:04 AM Dilip Kumar wrote: > On Mon, Oct 27, 2025 at 8:23 AM Zhijie Hou (Fujitsu) < > [email protected]> wrote: > >> On Friday, October 24, 2025 11:22 PM vignesh C >> wrote: >> > >> > On Thu, 23 Oct 2025 at 16:47, Amit Kapila >> wrote: >> > > >> > > On Thu, Oct 23,

Re: Optimize LISTEN/NOTIFY

2025-10-26 Thread Joel Jacobson
On Mon, Oct 27, 2025, at 02:27, Chao Li wrote: >> On Oct 27, 2025, at 07:24, Joel Jacobson wrote: >> >> Write-up of changes since v20: >> >> Two new fields have been added to QueueBackendStatus: >> + QueuePosition advisoryPos; /* safe skip-ahead position */ >> + bool advancingPos; /* backend is

Re: [PATCH] Little refactoring of portalcmds.c

2025-10-26 Thread Quan Zongliang
On 10/8/25 10:02 PM, Aleksander Alekseev wrote: Hi, The proposed patch places some repetitive code in a helper function. The value of this change is arguably not that high but it makes the code a bit neater IMO. It also reduces the ease of reading the code. Just add a function for a single

Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-10-26 Thread shveta malik
On Mon, Oct 27, 2025 at 7:44 AM Peter Smith wrote: > > Hi Sawada-San, > > Some review comments for v22-0002: > > == > doc/src/sgml/logicaldecoding.sgml > > 1. > consistency. Conversely, when the last logical replication slot is > dropped > - from a system with wal_level set to > rep

Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion

2025-10-26 Thread Fujii Masao
On Fri, Oct 24, 2025 at 1:25 AM Andrey Borodin wrote: > > Hi hackers, > > I'd like to propose a new archive_mode setting to address a gap in WAL > archiving for high availability streaming replication configurations. > > ## Problem > > In HA setups using streaming replication, standbys can be > pr

Re: Docs and tests for RLS policies applied by command type

2025-10-26 Thread jian he
On Thu, Oct 23, 2025 at 11:15 PM Dean Rasheed wrote: > > Attached is a new version with more comments in the tests, focusing on > what is expected from each test. > > > The 0001 regess tests define several functions: sel_using_fn, > > ins_check_fn, upd_using_fn, > > upd_check_fn, and del_using_fn.

Re: Logical Replication of sequences

2025-10-26 Thread Dilip Kumar
On Mon, Oct 27, 2025 at 8:23 AM Zhijie Hou (Fujitsu) wrote: > On Friday, October 24, 2025 11:22 PM vignesh C > wrote: > > > > On Thu, 23 Oct 2025 at 16:47, Amit Kapila > wrote: > > > > > > On Thu, Oct 23, 2025 at 11:45 AM vignesh C > wrote: > > > > > > > > The attached patch has the changes fo

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread David Rowley
On Mon, 27 Oct 2025 at 16:55, Tom Lane wrote: > Hmm, I wasn't really expecting any direct time saving; the point > was about cutting memory consumption. So Chao Li's nearby results > are in line with mine. It's for the same reason that Hash Join starts to run more slowly once the hash table is l

Re: issue with synchronized_standby_slots

2025-10-26 Thread Shlok Kyal
On Mon, 27 Oct 2025 at 09:35, Hayato Kuroda (Fujitsu) wrote: > > Dear Shlok, > > > I agree that .pg_reload_conf() is not required. I have removed it in > > the latest version of patches. > > Thanks for updating the patch! > After considering bit more, I started to feel the test should be under the

RE: issue with synchronized_standby_slots

2025-10-26 Thread Hayato Kuroda (Fujitsu)
Dear Shlok, > I agree that .pg_reload_conf() is not required. I have removed it in > the latest version of patches. Thanks for updating the patch! After considering bit more, I started to feel the test should be under the test/modules/unsafe_tests. Adding test requires that wal_level >= replica a

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread Tom Lane
David Rowley writes: >> On Mon, 27 Oct 2025 at 09:55, Tom Lane wrote: >>> I looked at the callers of BuildTupleHashTable, and realized that >>> (a) every one of them can use a BumpContext for the "tablecxt", >>> and (b) Jeff Davis already noticed that for nodeAgg.c, in commit >>> cc721c459. So w

Re: remove obsolete comment in AtEOXact_Inval

2025-10-26 Thread Chao Li
> On Oct 27, 2025, at 10:43, Steven Niu wrote: > > Hi, Hackers, > > When I read the code, I noticed there is one line of comment in function > AtEOXact_Inval() which is obviously obsolete. > > "This should be called as the last step in processing a transaction" > > Steven<0001-PATCH-

Re: Enhance statistics reset functions to return reset timestamp

2025-10-26 Thread David Rowley
On Sat, 9 Aug 2025 at 10:38, Andres Freund wrote: > On 2025-08-08 13:18:39 +0900, Shinya Kato wrote: > > I would like to propose a series of patches that enhance the behavior > > of various statistics reset functions by making them return the reset > > timestamp. This change improves usability and

Re: Enhance statistics reset functions to return reset timestamp

2025-10-26 Thread Shinya Kato
On Fri, Sep 12, 2025 at 3:31 PM Shinya Kato wrote: > > Hi, > > On Wed, Aug 13, 2025 at 4:06 PM Shinya Kato wrote: > > > > On Sat, Aug 9, 2025 at 7:37 AM Andres Freund wrote: > > > > > > Hi, > > > > > > On 2025-08-08 13:18:39 +0900, Shinya Kato wrote: > > > > I would like to propose a series of p

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread Chao Li
> On Oct 27, 2025, at 04:55, Tom Lane wrote: > > > I looked at the callers of BuildTupleHashTable, and realized that > (a) every one of them can use a BumpContext for the "tablecxt", > and (b) Jeff Davis already noticed that for nodeAgg.c, in commit > cc721c459. So we have precedent for the

Re: display hot standby state in psql prompt

2025-10-26 Thread Fujii Masao
On Sat, Oct 25, 2025 at 1:13 AM Jim Jones wrote: > > > > On 24/10/2025 17:21, Fujii Masao wrote: > > + const char *hs = PQparameterStatus(pset.db, "in_hot_standby"); > > + const char *ro = PQparameterStatus(pset.db, > > "default_transaction_read_only"); > > > > When either hs or ro is NULL, the d

Re: Should we say "wal_level = logical" instead of "wal_level >= logical"

2025-10-26 Thread Peter Smith
On Fri, Oct 24, 2025 at 9:09 PM Ashutosh Bapat wrote: > > On Wed, Oct 22, 2025 at 4:49 AM Peter Smith wrote: > > > > On Tue, Oct 21, 2025 at 2:11 AM Robert Haas wrote: > > > > > > On Mon, Oct 20, 2025 at 3:20 AM Peter Smith wrote: > > > > Do you have thoughts about the patch? > > > > > > I agre

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread David Rowley
On Mon, 27 Oct 2025 at 10:46, David Rowley wrote: > > On Mon, 27 Oct 2025 at 09:55, Tom Lane wrote: > > > > [ starting a new thread to keep this separate from the estimation > > issue ] > > > > I looked at the callers of BuildTupleHashTable, and realized that > > (a) every one of them can use a B

RE: Logical Replication of sequences

2025-10-26 Thread Zhijie Hou (Fujitsu)
On Friday, October 24, 2025 11:22 PM vignesh C wrote: > > On Thu, 23 Oct 2025 at 16:47, Amit Kapila wrote: > > > > On Thu, Oct 23, 2025 at 11:45 AM vignesh C wrote: > > > > > > The attached patch has the changes for the same. > > > > > > > I have pushed 0001 and the following are comments on 00

remove obsolete comment in AtEOXact_Inval

2025-10-26 Thread Steven Niu
Hi, Hackers, When I read the code, I noticed there is one line of comment in function AtEOXact_Inval() which is obviously obsolete. "This should be called as the last step in processing a transaction" AtEOXact_Inval() is called in CommitTransaction() and AbortTransaction() and there are ma

Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-10-26 Thread Peter Smith
Hi Sawada-San, Some review comments for v22-0002: == doc/src/sgml/logicaldecoding.sgml 1. consistency. Conversely, when the last logical replication slot is dropped - from a system with wal_level set to replica, - logical decoding is automatically disabled. Note that the deacti

Re: Optimize LISTEN/NOTIFY

2025-10-26 Thread Chao Li
> On Oct 27, 2025, at 07:24, Joel Jacobson wrote: > > Write-up of changes since v20: > > Two new fields have been added to QueueBackendStatus: > + QueuePosition advisoryPos; /* safe skip-ahead position */ > + bool advancingPos; /* backend is reading the queue */ > > These are used SignalBack

Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-10-26 Thread Peter Smith
Hi Sawada. A couple of comments for v22-0001. == 1. + /* + * We don't need this warning message when wal_level >= 'replica' since + * logical decoding is automatically enabled up on a logical slot + * creation. + */ + if (wal_level == WAL_LEVEL_MINIMAL) ereport(WARNING, (errcode(ERRCODE_

Re: Cannot log in to CommitFest due to cool-off period

2025-10-26 Thread Mihail Nikalayeu
Hi! As far as I remember - it is about a week. Chao Li is right - start with the thread with the patch. Anyway email thread is required to create commitfest entry. Best regards, Mikhail.

Re: Cannot log in to CommitFest due to cool-off period

2025-10-26 Thread Chao Li
> On Oct 27, 2025, at 01:49, Mahmoud Ayman wrote: > > Hi CommitFest maintainers, > I recently signed in to the PostgreSQL website using my Google account, but > I’m still unable to access the CommitFest app. I’m receiving the following > message: > ``` > The site you are trying to log in to (

Re: Optimize LISTEN/NOTIFY

2025-10-26 Thread Joel Jacobson
On Sun, Oct 26, 2025, at 07:33, Joel Jacobson wrote: > On Sun, Oct 26, 2025, at 05:11, Chao Li wrote: >> I figured out a way to resolve the race condition for alt3: >> >> * add an awakening flag for every listener, this flag is only set by >> listeners >> * add an advisory pos for every listener,

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread Tom Lane
David Rowley writes: > On Mon, 27 Oct 2025 at 11:11, Tom Lane wrote: >> ... We could keep it in that same "tablectx" > I don't think you could do that and have your patch as SH_GROW() needs > to pfree the old bucket array after rehashing, which bump won't like. Ah, good point. Nevermind that i

Re: Should HashSetOp go away

2025-10-26 Thread Tom Lane
David Rowley writes: > If Hash Joins did support IS NOT DISTINCT FROM clauses, then at least > the non-ALL cases could be done with Hash Semi Join and Hash Anti Join > for INTERSECT and EXCEPT, respectively, followed by a HashAgg. I doubt > it would be any faster for the general case, but at least

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread David Rowley
On Mon, 27 Oct 2025 at 11:11, Tom Lane wrote: > Related to this, while I was chasing Jeff's complaint I realized that > the none-too-small simplehash table for this is getting made in the > query's ExecutorState. That's pretty awful from the standpoint of > being able to blame memory consumption

Re: Should HashSetOp go away

2025-10-26 Thread David Rowley
On Mon, 27 Oct 2025 at 07:00, Tom Lane wrote: > > Jeff Janes writes: > > I was thinking of ways to improve the memory usage (or at least its > > estimation) but decided maybe it would be better if HashSetOp went away > > entirely. As far as I can tell HashSetOp has nothing to recommend it other

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread Tom Lane
David Rowley writes: > I can't help wonder if we can improve the memory context parameter > names in BuildTupleHashTable(). Every time I see "tablecxt" I have to > remind myself that it's not for the bucket array, just the stuff we > have the buckets point to. Would "hashedtuplecxt" be better? I

Re: PG18 GIN parallel index build crash - invalid memory alloc request size

2025-10-26 Thread Tomas Vondra
On 10/26/25 16:16, Tomas Vondra wrote: > On 10/24/25 22:22, Gregory Smith wrote: >> On Fri, Oct 24, 2025 at 8:38 AM Tomas Vondra > > wrote: >> >> ... Can you show the contents of buffer and tup? I'm especially interested >> in these fields: >>   buffer->nite

Re: Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread David Rowley
On Mon, 27 Oct 2025 at 09:55, Tom Lane wrote: > > [ starting a new thread to keep this separate from the estimation > issue ] > > I looked at the callers of BuildTupleHashTable, and realized that > (a) every one of them can use a BumpContext for the "tablecxt", > and (b) Jeff Davis already noticed

Re: High CPU consumption in cascade replication with large number of walsenders

2025-10-26 Thread Alexander Korotkov
Hi, Alexey! Thank you for your comment and patch revision. I have some further question to you. On Tue, Sep 16, 2025 at 6:20 PM Alexey Makhmutov wrote: > Thank you very much for looking at the patch and providing valuable > feedback! > > > This approach makes sense to me. Do you think it migh

Use BumpContext contexts for TupleHashTables' tablecxt

2025-10-26 Thread Tom Lane
[ starting a new thread to keep this separate from the estimation issue ] I looked at the callers of BuildTupleHashTable, and realized that (a) every one of them can use a BumpContext for the "tablecxt", and (b) Jeff Davis already noticed that for nodeAgg.c, in commit cc721c459. So we have preced

Re: Should HashSetOp go away

2025-10-26 Thread Tom Lane
I wrote: > Jeff Janes writes: >> I noticed some changes in this code v18, so wanted to revisit the issue. >> Under commit 27627929528e, it looks like it got 25% more memory efficient, >> but it thinks it got 40% more efficient, so the memory use got better but >> the estimation actually got worse.

Re: C11: should we use char32_t for unicode code points?

2025-10-26 Thread Jeff Davis
On Sat, 2025-10-25 at 16:21 +1300, Thomas Munro wrote: > I > guess you could static_assert(__STDC_UTF_32__, "char32_t must use > UTF-32 encoding"). Done. >   It's also defined as at least, not exactly, 32 > bits but we already require the machine to have uint32_t so it must > be > exactly 32 bits

Re: Should HashSetOp go away

2025-10-26 Thread Tom Lane
Jeff Janes writes: > I noticed some changes in this code v18, so wanted to revisit the issue. > Under commit 27627929528e, it looks like it got 25% more memory efficient, > but it thinks it got 40% more efficient, so the memory use got better but > the estimation actually got worse. Hmm, so why n

Cannot log in to CommitFest due to cool-off period

2025-10-26 Thread Mahmoud Ayman
Hi CommitFest maintainers, I recently signed in to the PostgreSQL website using my Google account, but I’m still unable to access the CommitFest app. I’m receiving the following message: ``` The site you are trying to log in to (commitfest.postgresql.org) requires a cool-off period between accoun

Should HashSetOp go away

2025-10-26 Thread Jeff Janes
Many years ago I ran into some problems doing maintenance tasks checking for short identifiers which existed in one table but not another. It would choose HashSetOp, which was memory inefficient, and it was also unaware of how memory inefficient it was, leading it to blow well past work_mem, by ma

Re: PG18 GIN parallel index build crash - invalid memory alloc request size

2025-10-26 Thread Tomas Vondra
On 10/24/25 22:22, Gregory Smith wrote: > On Fri, Oct 24, 2025 at 8:38 AM Tomas Vondra > wrote: > > Hmmm, I wonder if the m_w_m is high enough to confuse the trimming logic > in some way. Can you try if using smaller m_w_m (maybe 128MB-256MB) > makes the issue

tests: fix an unexpected termination of the test script when calling 'query()'

2025-10-26 Thread aitsygunka
Hi When writing my own test, I discovered that when calling the query() method after the psql session was terminated for some reason, the test script also terminates prematurely without returning an error. This occurs when calling pump_until() to get the stderr stream in query() (detected on L

Re: Bug in pg_stat_statements

2025-10-26 Thread Dmitry Dolgov
> On Fri, Oct 24, 2025 at 07:04:59PM -0500, Sami Imseih wrote: > v4 corrects some code comments. The fix in the first patch looks good, thanks. Not so sure about the refactoring in the second patch -- generate_normalized_query is being used only in one place, in pg_stat_statements, moving it out s

Re: Channel binding for post-quantum cryptography

2025-10-26 Thread Filip Janus
Hi, Thank you for the detailed feedback. Let me address your points: Test Case = I have prepared a test case following the pattern from commit 9244c11afe23 (RSA-PSS fix). Regarding the Hash Algorithm = You are correct that, according to RFC 5929, we should i

Re: Optimize LISTEN/NOTIFY

2025-10-26 Thread Joel Jacobson
On Sun, Oct 26, 2025, at 07:33, Joel Jacobson wrote: > Trying to apply them on top of current master > (39dcfda2d23ac39f14ecf4b83e01eae85d07d9e5): > > ``` > % git apply 0001-optimize_listen_notify-v20.patch > % git apply 0002-optimize_listen_notify-v20.patch > % git apply 0002-optimize_listen_noti