Re: UUID v7

2024-11-22 Thread Masahiko Sawada
On Fri, Nov 22, 2024 at 2:37 PM Masahiko Sawada wrote: > > On Thu, Nov 21, 2024 at 1:22 PM Andrey M. Borodin > wrote: > > > > > > > > > On 21 Nov 2024, at 02:24, Masahiko Sawada wrote: > > > > > > But does replacing the least significant 2 bits > > > with random 2 bits really not affect monoto

Re: CREATE SCHEMA ... CREATE DOMAIN support

2024-11-22 Thread jian he
On Tue, Nov 12, 2024 at 8:55 PM Kirill Reshke wrote: > > Patch obviously leaks doc & regression tests, but I'm posting it to > see if this contribution is needed in PostgreSQL the following two statement should fail: CREATE SCHEMA regress_schema_2 AUTHORIZATION CURRENT_ROLE CREATE table t(a ss)

Re: SIMD optimization for list_sort

2024-11-22 Thread Andrei Lepikhov
On 22/11/2024 06:27, Giacchino, Luca wrote: We’d appreciate feedback on this approach. In the meantime, we will complete the patch to share. We also plan to extend SIMD-based sort to tuple sort in the future. Nice! I continually see performance reports when sorting and group order impact perfor

Re: SIMD optimization for list_sort

2024-11-22 Thread John Naylor
On Fri, Nov 22, 2024 at 6:27 AM Giacchino, Luca wrote: > We’d appreciate feedback on this approach. In the meantime, we will complete > the patch to share. We also plan to extend SIMD-based sort to tuple sort in > the future. Coincidentally, I'll be prototyping a tuple sort that will take bette

Re: Allow non-superuser to cancel superuser tasks.

2024-11-22 Thread Nathan Bossart
On Fri, Nov 22, 2024 at 06:13:16PM -0500, Andres Freund wrote: >> -if (procStatus && procStatus->st_backendType == >> B_AUTOVAC_WORKER) >> +if (pgstat_get_backend_type(pid) == B_AUTOVAC_WORKER) > > Because we already mapped the pid to a ProcNumber, it'd be cheaper to acces

Re: Windows pg_basebackup unable to create >2GB pg_wal.tar tarballs ("could not close file: Invalid argument" when creating pg_wal.tar of size ~ 2^31 bytes)

2024-11-22 Thread Thomas Munro
On Fri, Nov 22, 2024 at 10:55 PM Jakub Wartak wrote: > but with attached _lseeki64 dirty patch I've got success and resulting > tarball greater than 2^31 too: > > C:\compiledpg\bin>pg_basebackup.exe -U postgres -D "c:\backup7" -F t -P -X > stream -c fast --compress=none --create-slot --slot=slot

Re: Allow non-superuser to cancel superuser tasks.

2024-11-22 Thread Andres Freund
Hi, On 2024-11-22 13:21:53 -0600, Nathan Bossart wrote: > Here is a draft-grade patch for this one. It seems pretty > straightforward... Thanks for looking into it quickly. > diff --git a/src/backend/storage/ipc/signalfuncs.c > b/src/backend/storage/ipc/signalfuncs.c > index aa729a36e3..8e165

Re: UUID v7

2024-11-22 Thread Masahiko Sawada
On Thu, Nov 21, 2024 at 1:22 PM Andrey M. Borodin wrote: > > > > > On 21 Nov 2024, at 02:24, Masahiko Sawada wrote: > > > > But does replacing the least significant 2 bits > > with random 2 bits really not affect monotonicity? > > You are right. We have to take into account this when calculating

Re: Interrupts vs signals

2024-11-22 Thread Heikki Linnakangas
On 19/11/2024 23:02, Robert Haas wrote: On Mon, Nov 18, 2024 at 11:09 PM Thomas Munro wrote: Names don't match here. I prefer _CONTINUE. As for the general one, I'm on the fence about INTERRUPT_GENERAL_WAKEUP, since wakeups aren't necessarily involved, but I don't have a specific better idea

Re: Interrupts vs signals

2024-11-22 Thread Heikki Linnakangas
On 19/11/2024 06:09, Thomas Munro wrote: It looks like maybeSleepingOnInterrupts replaces maybe_sleeping, and SendInterrupt() would need to read it to suppress needless kill() calls, but doesn't yet, or am I missing something? Ah yes, you're right. Hmm, I think there are two kinds of kill() s

Re: On non-Windows, hard depend on uselocale(3)

2024-11-22 Thread Thomas Munro
On Thu, Nov 21, 2024 at 8:38 PM Peter Eisentraut wrote: > On 20.11.24 10:00, Thomas Munro wrote: > > OK, do you think these three patches tell the _configthreadlocale() > > story properly? (Then after that we can get back to getting rid of > > it...) > > Yes, this is very clear and helpful. Than

Re: smgrextendv and vectorizing the bulk_write implementation

2024-11-22 Thread Heikki Linnakangas
On 22/11/2024 19:49, Matthias van de Meent wrote: Hi, While working on the fix for [0] I noticed that bulk_write doens't use any of the new vectorized IO features, which seemed like a waste. After looking into it a bit deeper, I noticed the opportunity for write vectorization was not very high,

Re: SIMD optimization for list_sort

2024-11-22 Thread Nathan Bossart
On Fri, Nov 22, 2024 at 06:01:22PM +0200, Heikki Linnakangas wrote: > On 22/11/2024 01:27, Giacchino, Luca wrote: >> We´d appreciate feedback on this approach. In the meantime, we will >> complete the patch to share. We also plan to extend SIMD-based sort to >> tuple sort in the future. > > If you

Re: Statistics Import and Export

2024-11-22 Thread Nathan Bossart
I took another look at v32-0001 and v32-0002, and they look reasonable to me. Unless additional feedback materializes, I'll plan on committing those soon. After that, it might be a good idea to take up the vacuumdb changes next, since there's been quite a bit of recent discussion about those. I

Re: explain plans for foreign servers

2024-11-22 Thread dinesh salve
On Tue, Nov 12, 2024 at 4:16 PM Ashutosh Bapat wrote: > On Mon, Nov 11, 2024 at 9:12 PM dinesh salve > wrote: > > > > > > Hi Hackers, > > > > I am working on a feature in postgres_fdw extension to show plans used > by remote postgresql servers in the output of the EXPLAIN command. > > I think th

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-11-22 Thread Masahiko Sawada
On Wed, Nov 20, 2024 at 6:55 PM Sutou Kouhei wrote: > > Hi, > > In > "Re: Make COPY format extendable: Extract COPY TO format implementations" > on Wed, 20 Nov 2024 14:14:27 -0800, > Masahiko Sawada wrote: > > > I've extracted the changes to refactor COPY TO/FROM to use the format > > callb

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-22 Thread Devulapalli, Raghuveer
> I think we should still use the test program even when __SSE4_2__ is defined, > but > we can use that macro to determine whether to use a runtime check. I think > that > would keep autoconf and meson consistent. Sure. Updated patch. v5-0001-Use-__attribute__-target-sse4.2-for-SSE42-CRC32C.p

Re: Make COPY format extendable: Extract COPY TO format implementations

2024-11-22 Thread Masahiko Sawada
On Thu, Nov 21, 2024 at 2:41 AM Alvaro Herrera wrote: > > I ran `make headerscheck` after these patches and it reported a few > problems: > > /pgsql/source/master/src/tools/pginclude/headerscheck /pgsql/source/master > /pgsql/build/master > In file included from /tmp/headerscheck.xdG40Y/test.c:2:

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-22 Thread Nathan Bossart
On Thu, Nov 21, 2024 at 11:07:59PM +, Devulapalli, Raghuveer wrote: > Thanks for the review! We can actually leverage meson's built in option > to check for a macro: cc.get_define('__SSE4_2__') != ''. This should keep > the logic consistent across configure and meson. I think we should still

Re: Allow non-superuser to cancel superuser tasks.

2024-11-22 Thread Nathan Bossart
On Fri, Nov 22, 2024 at 12:13:49PM -0500, Andres Freund wrote: > I justed ended up looking at this code for some boring reason. One thing that > has me worried a bit is that pg_signal_backend() now does > pgstat_get_beentry_by_proc_number(), triggering a pgstat_read_current_status() > further down.

Re: Document NULL

2024-11-22 Thread Jeff Davis
On Fri, 2024-06-28 at 13:39 -0700, David G. Johnston wrote: > The attached are complete and ready for review.  I did some file > structure reformatting at the end and left that as the second patch.  > The first contains all of the content. I read through v4-0001. Thank you for working on this! I

Re: pg_ctl/miscinit: print "MyStartTime" as a long long instead of long to avoid 2038 problem.

2024-11-22 Thread Nathan Bossart
On Tue, Nov 19, 2024 at 05:00:43PM -0600, Nathan Bossart wrote: > If there are no concerns, I plan on committing this soon. Committed. -- nathan

Re: Extract numeric filed in JSONB more effectively

2024-11-22 Thread Dmitry Dolgov
> On Mon, Nov 18, 2024 at 08:23:52AM GMT, Andy Fan wrote: > > >> > I imagined you'd the patch should create a SupportRequestSimplify > >> > support function for jsonb_numeric() that checks if the input > >> > expression is an OpExpr with funcid of jsonb_object_field(). All you > >> > do then is di

Re: Allow non-superuser to cancel superuser tasks.

2024-11-22 Thread Kirill Reshke
On Fri, 22 Nov 2024 at 22:13, Andres Freund wrote: > > Hi, > > On 2024-07-09 13:12:59 -0500, Nathan Bossart wrote: > > I've committed 0001. > > I justed ended up looking at this code for some boring reason. One thing that > has me worried a bit is that pg_signal_backend() now does > pgstat_get_bee

smgrextendv and vectorizing the bulk_write implementation

2024-11-22 Thread Matthias van de Meent
Hi, While working on the fix for [0] I noticed that bulk_write doens't use any of the new vectorized IO features, which seemed like a waste. After looking into it a bit deeper, I noticed the opportunity for write vectorization was not very high, as one would expect most bulk_write IOs to be smgrex

Re: ci: Macos failures due to MacPorts behaviour change

2024-11-22 Thread Andres Freund
Hi, On 2024-11-21 14:24:26 +1300, Thomas Munro wrote: > Oh, and yeah, we should include the branch name in the cache key. > Something like the attached. I think that'd be too granular - we'd end up with lots of copies of effectively the same cache, but which won't exactly the same due to timestam

Re: Allow non-superuser to cancel superuser tasks.

2024-11-22 Thread Andres Freund
Hi, On 2024-07-09 13:12:59 -0500, Nathan Bossart wrote: > I've committed 0001. I justed ended up looking at this code for some boring reason. One thing that has me worried a bit is that pg_signal_backend() now does pgstat_get_beentry_by_proc_number(), triggering a pgstat_read_current_status() fur

Re: Replace current implementations in crypt() and gen_salt() to OpenSSL

2024-11-22 Thread Robert Haas
On Thu, Nov 21, 2024 at 4:39 PM Joe Conway wrote: > I mean, perhaps I am misreading and/or interpreting all of that > differently to you, but from my reading of the entire thread there was > clearly no consensus to using openssl to provide those two functions. OK, I see the problem now. I don't i

Re: Planner picks n² query plan when available

2024-11-22 Thread Tom Lane
Matthias van de Meent writes: > On Thu, 21 Nov 2024 at 13:03, Toto guyoyg wrote: >> It looks like this could be improved/fixed by either/all of: >> >> 1. Using a hashset (or sort + binary search) for recheck (past a certain >> array length or even always) instead of always searching linearly >

Re: Offsets of `struct Port` are no longer constant

2024-11-22 Thread Jacob Champion
On Fri, Nov 22, 2024 at 8:06 AM Heikki Linnakangas wrote: > Ok, committed the "placeholder" fields to master, and just comment fixes > to REL_17_STABLE. Thanks! --Jacob

Re: Offsets of `struct Port` are no longer constant

2024-11-22 Thread Heikki Linnakangas
On 11/11/2024 21:43, Daniel Gustafsson wrote: On 11 Nov 2024, at 20:17, Jacob Champion wrote: On Mon, Nov 11, 2024 at 11:13 AM Heikki Linnakangas wrote: On REL_17_STABLE, we should probably adjust the comment to warn that 'raw_buf' and friends can move depending on USE_OPENSSL. Yeah, make

Re: SIMD optimization for list_sort

2024-11-22 Thread Heikki Linnakangas
On 22/11/2024 01:27, Giacchino, Luca wrote: The existing list_sort takes a comparator function to compare pairs of ListCell. On the other hand, x86-simd-sort requires an array of numeric values to sort, and it returns an array of sorted indices. To enable x86-simd-sort, we add new list_sort_sim

Re: Consider pipeline implicit transaction as a transaction block

2024-11-22 Thread Anthonin Bonnefoy
Some minor changes: I forgot to add the new pipeline meta-commands to psql's help output, this is now added in 0002. I've also reworded the doc a bit. v04-0001-Reset-query-buffer-on-a-backslash-error.patch Description: Binary data v04-0002-Add-pipeline-support-in-psql.patch Description: Binary

Re: Changed behavior in rewriteheap

2024-11-22 Thread Erik Nordström
On Fri, Nov 22, 2024 at 3:53 PM Heikki Linnakangas wrote: > On 22/11/2024 15:56, Erik Nordström wrote: > > Yes, it solves the issue so it looks good. > > > > Just a minor nit: the code uses both blokno as local variable for > > pending_writes[i].blkno and directly accessing pending_writes[i].blkn

Re: Changed behavior in rewriteheap

2024-11-22 Thread Heikki Linnakangas
On 22/11/2024 15:56, Erik Nordström wrote: Yes, it solves the issue so it looks good. Just a minor nit: the code uses both blokno as local variable for pending_writes[i].blkno and directly accessing pending_writes[i].blkno. Maybe it is better to just use the local variable. For example, change

Re: PoC: prefetching data between executor nodes (e.g. nestloop + indexscan)

2024-11-22 Thread Tomas Vondra
FYI I've marked the CF entry as withdrawn. I still think this (triggering prefetching in another exector node) has a lot of potential, and not only in the context of a nested loop. But the patch was just a quick & dirty experiment, I don't have time to work on this right now. No point in keeping t

Re: Replace current implementations in crypt() and gen_salt() to OpenSSL

2024-11-22 Thread Daniel Gustafsson
> On 21 Nov 2024, at 22:39, Joe Conway wrote: > I mean, perhaps I am misreading and/or interpreting all of that differently > to you, but from my reading of the entire thread there was clearly no > consensus to using openssl to provide those two functions. My interpretation (or perhaps, my opi

Re: Changed behavior in rewriteheap

2024-11-22 Thread Erik Nordström
On Fri, Nov 22, 2024 at 2:26 PM Heikki Linnakangas wrote: > On 22/11/2024 15:02, Matthias van de Meent wrote: > > I think I'd go with a patch like attached, where the bulk writer > > registers that it started with .relsize pages in the relfork, and use > > that for smgrextend() decisions. It now

Re: psql: Fix \pset by adding missed xheader_width option to the help

2024-11-22 Thread Pavel Luzanov
On 22.11.2024 05:52, Michael Paquier wrote: On Thu, Nov 21, 2024 at 10:50:41PM +0300, Pavel Luzanov wrote: I found that the help for \pset command missed xheader_width option. Good catch. This is a mistake from a45388d6e098. The patch should have used HELP0() as this is a single variable, and

Re: Changed behavior in rewriteheap

2024-11-22 Thread Heikki Linnakangas
On 22/11/2024 15:02, Matthias van de Meent wrote: I think I'd go with a patch like attached, where the bulk writer registers that it started with .relsize pages in the relfork, and use that for smgrextend() decisions. It now also records pages_written as a separate but accurate value. Looks goo

Re: Remove useless GROUP BY columns considering unique index

2024-11-22 Thread jian he
On Thu, Sep 12, 2024 at 9:44 AM David Rowley wrote: > > On Sat, 30 Dec 2023 at 04:05, Zhang Mingli wrote: > > So my patch make it easy: check unique index’s columns, it’s a valid > > candidate if all of that have NOT NULL constraint. > > And we choose a best one who has the least column numbers

Re: Enhancing Memory Context Statistics Reporting

2024-11-22 Thread Rahila Syed
Hi, How does the process know that the client backend has finished reading > stats and it can be refreshed? What happens, if the next request for > memory context stats comes before first requester has consumed the > statistics it requested? > > A process that's copying its statistics does not nee

Re: Changed behavior in rewriteheap

2024-11-22 Thread Matthias van de Meent
On Fri, 22 Nov 2024 at 09:11, Erik Nordström wrote: > > > > On Fri, Nov 22, 2024 at 12:30 AM Matthias van de Meent > wrote: >> >> On Thu, 21 Nov 2024, 17:18 Erik Nordström, wrote: >>> >>> Hello, >>> >>> I've noticed a change in behavior of the heap rewrite functionality in >>> PostgreSQL 17, u

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-11-22 Thread vignesh C
On Thu, 21 Nov 2024 at 17:35, Nisha Moond wrote: > > On Wed, Nov 20, 2024 at 1:29 PM vignesh C wrote: > > > > On Tue, 19 Nov 2024 at 12:43, Nisha Moond wrote: > > > > > > Attached is the v49 patch set: > > > - Fixed the bug reported in [1]. > > > - Addressed comments in [2] and [3]. > > > > > >

Re: Windows pg_basebackup unable to create >2GB pg_wal.tar tarballs ("could not close file: Invalid argument" when creating pg_wal.tar of size ~ 2^31 bytes)

2024-11-22 Thread Jakub Wartak
Hi Thomas! On Thu, Nov 21, 2024 at 2:38 PM Thomas Munro wrote: > On Thu, Nov 21, 2024 at 11:44 PM Jakub Wartak > wrote: > > This literally looks like something like off_t/size_t would be limited > to 2^31 somewhere. > > off_t is 32 bits on Windows. I'd be quite suspicious of the > arithmetic i

Re: Adding skip scan (including MDAM style range skip scan) to nbtree

2024-11-22 Thread Masahiro Ikeda
On 2024-11-21 17:47, Masahiro Ikeda wrote: On 2024-11-21 04:40, Peter Geoghegan wrote: diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index b70b58e0c..ddae5f2a1 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @

Re: [EXTERNAL] Re: Add non-blocking version of PQcancel

2024-11-22 Thread Jelte Fennema-Nio
On Fri, 22 Nov 2024 at 01:37, Tom Lane wrote: > How would we do that? libpqsrv_cancel is not chartered to wait around > for the results of the cancel, and I'm not even sure that it could > know what to check for. Ah yeah, you're right. I got confused by the two timeouts (the one to wait for the

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-22 Thread Andrei Lepikhov
On 11/13/24 13:49, Richard Guo wrote: On Mon, Oct 28, 2024 at 6:15 PM Andrei Lepikhov wrote: On 6/7/24 16:46, Richard Guo wrote: I'm not sure about merging these two 'reordering' GUCs into one. While they may look similar, they apply to very different scenarios. However, I'm open to other sugg

Re: Changed behavior in rewriteheap

2024-11-22 Thread Erik Nordström
On Fri, Nov 22, 2024 at 12:30 AM Matthias van de Meent < boekewurm+postg...@gmail.com> wrote: > On Thu, 21 Nov 2024, 17:18 Erik Nordström, wrote: > >> Hello, >> >> I've noticed a change in behavior of the heap rewrite functionality in >> PostgreSQL 17, used by, e.g., CLUSTER. I've been experiment