Re: Draft LIMIT pushdown to Append and MergeAppend patch

2023-10-07 Thread Michał Kłeczek
Thanks for the feedback. > On 8 Oct 2023, at 03:33, Andy Fan wrote: > > > > On Sun, Oct 8, 2023 at 5:04 AM Michał Kłeczek > wrote: >> Hi All, >> >> Attached is a second version of the patch. >> >> The goal is to: >> 1. Apply LIMIT as early as possible - especially

Re: pg_upgrade --copy-file-range

2023-10-07 Thread Thomas Munro
On Mon, Jul 3, 2023 at 7:47 PM Peter Eisentraut wrote: > When we added --clone, copy_file_range() was available, but the problem > was that it was hard for the user to predict whether you'd get the fast > clone behavior or the slow copy behavior. That's the kind of thing you > want to know when p

Re: Fix output of zero privileges in psql

2023-10-07 Thread Laurenz Albe
On Sat, 2023-10-07 at 20:41 +0200, Erik Wienhold wrote: > > If you are happy enough with my patch, shall we mark it as ready for > > committer? > > I amended your patch to also document the effect of \pset null in this > case.  See the attached v2. +1 If you mention in ddl.sgml that you can use

Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2023-10-07 Thread Quan Zongliang
Implement TODO item: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block Currently it displays zero. Check that the XID has been assigned at the location where the statement log is now printed. If not, no statement log is output. And then be

Re: Invalidate the subscription worker in cases where a user loses their superuser status

2023-10-07 Thread vignesh C
On Sat, 7 Oct 2023 at 08:12, Amit Kapila wrote: > > On Tue, Oct 3, 2023 at 12:12 PM vignesh C wrote: > > > > Thanks for the comments, the attached v6 version patch has the changes > > for the same. > > > > Few comments: > = > 1. > /* Is the use of a password mandatory? */ > must_use

Re: Unlogged relation copy is not fsync'd

2023-10-07 Thread Noah Misch
On Wed, Sep 20, 2023 at 11:22:10PM -0700, Noah Misch wrote: > On Fri, Sep 15, 2023 at 02:47:45PM +0300, Heikki Linnakangas wrote: > > On 05/09/2023 21:20, Robert Haas wrote: > > > Thinking about this some more, I think this is still not 100% correct, even > > with the patch I posted earlier: > >

Re: Draft LIMIT pushdown to Append and MergeAppend patch

2023-10-07 Thread Andy Fan
On Sun, Oct 8, 2023 at 5:04 AM Michał Kłeczek wrote: > Hi All, > > Attached is a second version of the patch. > > The goal is to: > 1. Apply LIMIT as early as possible - especially to apply LIMIT in > partition scans > For the patches for performance improvement, it is better to provide an exam

Re: CREATE DATABASE with filesystem cloning

2023-10-07 Thread Thomas Munro
One thing I forgot to mention about this experiment: when used in a backend I think this probably needs a chunk size (what size?) and a CFI(). Which is a bit annoying, because for best results we want SSIZE_MAX, but in the case that copy_file_range() falls back to raw copy, that'd do I/O work boun

Re: Draft LIMIT pushdown to Append and MergeAppend patch

2023-10-07 Thread Michał Kłeczek
Hi All, Attached is a second version of the patch. The goal is to: 1. Apply LIMIT as early as possible - especially to apply LIMIT in partition scans 2. Enable LIMIT pushdown for FDW partitions. Main idea of the patch is: 1. Wrap children of Append and MergeAppend paths in LimitPaths. 2. Let F

Re: Fix output of zero privileges in psql

2023-10-07 Thread Erik Wienhold
On 2023-10-07 14:29 +0200, Laurenz Albe write: > On Sat, 2023-10-07 at 05:07 +0200, Erik Wienhold wrote: > > On 2023-10-06 22:32 +0200, Laurenz Albe write: > > > On Sun, 2023-09-17 at 21:31 +0200, Erik Wienhold wrote: > > > > I wrote a patch to change psql's display of zero privileges after a > >

Re: Index range search optimization

2023-10-07 Thread Alexander Korotkov
On Fri, Oct 6, 2023 at 9:59 PM Pavel Borisov wrote: > On Fri, 6 Oct 2023 at 22:44, Konstantin Knizhnik wrote: > > > > > > On 04/10/2023 3:00 am, Alexander Korotkov wrote: > > > On Wed, Oct 4, 2023 at 12:59 AM Pavel Borisov > > > wrote: > > >> I've looked through the patch v8. I think it's good

Re: Fix a typo in _bt_readpage

2023-10-07 Thread Alexander Korotkov
On Sat, Oct 7, 2023 at 2:02 PM Richard Guo wrote: > > I just noticed that e8c334c47a fixes typos in e0b1ee17dc. I think there > is an omission in _bt_readpage. > > --- a/src/backend/access/nbtree/nbtsearch.c > +++ b/src/backend/access/nbtree/nbtsearch.c > @@ -1784,7 +1784,7 @@ _bt_readpage(IndexS

Re: Annoying build warnings from latest Apple toolchain

2023-10-07 Thread Tom Lane
Andres Freund writes: > On 2023-10-05 13:37:38 -0400, Tom Lane wrote: >> Hm. IIUC that would result in an error if someone did try to >> put some c_args into default_bin_args, and I didn't think it would >> be appropriate for this code to fail in such a case. Still, I see >> there are a bunch of

Re: remaining sql/json patches

2023-10-07 Thread Alvaro Herrera
On 2023-Oct-06, Andres Freund wrote: > > +json_query_behavior: > > + ERROR_P { $$ = > > makeJsonBehavior(JSON_BEHAVIOR_ERROR, NULL, @1); } > > + | NULL_P{ $$ = > > makeJsonBehavior(JSON_BEHAVIOR_NULL, NULL, @1); } > > +

Re: Fix output of zero privileges in psql

2023-10-07 Thread Laurenz Albe
On Sat, 2023-10-07 at 05:07 +0200, Erik Wienhold wrote: > On 2023-10-06 22:32 +0200, Laurenz Albe write: > > On Sun, 2023-09-17 at 21:31 +0200, Erik Wienhold wrote: > > > I wrote a patch to change psql's display of zero privileges after a user's > > > reported confusion with the psql output for zer

Fix a typo in _bt_readpage

2023-10-07 Thread Richard Guo
I just noticed that e8c334c47a fixes typos in e0b1ee17dc. I think there is an omission in _bt_readpage. --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -1784,7 +1784,7 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum)

Re: Wrong results with grouping sets

2023-10-07 Thread Richard Guo
On Mon, Sep 25, 2023 at 3:11 PM Richard Guo wrote: > I think the root cause is that when we generate distinct_pathkeys, we > failed to realize that Var 'b' might be nullable by the grouping sets, > so it's no longer always equal to Var 'a'. It's not correct to deem > that the PathKey for 'b' is

Draft LIMIT pushdown to Append and MergeAppend patch

2023-10-07 Thread Michał Kłeczek
Hi All, Attached is a draft patch implementing LIMIT pushdown to Append and MergeAppend nodes. This patch eliminates the need to resort to subqueries to optimise UNIONs. It also enables more aggressive partition pruning. Not sure if it causes LIMIT pushdown to foreign partitions though. Applyin

Check each of base restriction clauses for constant-FALSE-or-NULL

2023-10-07 Thread Richard Guo
In relation_excluded_by_constraints() when we're trying to figure out whether the relation need not be scanned, one of the checks we do is to detect constant-FALSE-or-NULL restriction clauses. Currently we perform this check only when there is exactly one baserestrictinfo entry, and the comment ex