Re: Possible copy and past error? (\usr\backend\commands\analyze.c)

2020-03-27 Thread Tom Lane
Ranier Vilela writes: > Can someone check if there is a copy and paste error, at file: > \usr\backend\commands\analyze.c, at lines 2225 and 2226? > int num_mcv = stats->attr->attstattarget; > int num_bins = stats->attr->attstattarget; No, that's intentional I believe. Those are independent

Re: Make MemoryContextMemAllocated() more precise

2020-03-27 Thread Jeff Davis
On Wed, 2020-03-18 at 15:41 -0700, Jeff Davis wrote: > In an off-list discussion, Andres suggested that MemoryContextStats > could be refactored to achieve this purpose, perhaps with flags to > avoid walking through the blocks and freelists when those are not > needed. Attached refactoring patch.

Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM

2020-03-27 Thread Peter Geoghegan
On Fri, Mar 27, 2020 at 8:58 AM Michail Nikolaev wrote: > I have spent some time trying to find any possible race condition > between btree_xlog_split and _bt_walk_left… But I can’t find any. > Also, I have tried to cause any issue by putting pg_sleep put into > btree_xlog_split (between

proposal - psql output file write mode

2020-03-27 Thread Pavel Stehule
Hi I am playing with pspg and inotify support. It is working pretty well and now can be nice if forwarding to output file can be configured little bit more. Now, only append mode is supported. But append mode doesn't work with pspg pager. So I propose new pset option "file_output_mode" with two

Re: improve transparency of bitmap-only heap scans

2020-03-27 Thread Amit Kapila
On Wed, Mar 25, 2020 at 5:44 PM James Coleman wrote: > > On Tue, Mar 24, 2020 at 11:02 PM Amit Kapila wrote: > > > > On Wed, Mar 25, 2020 at 12:44 AM Tom Lane wrote: > > > > > > I took a quick look through this patch. While I see nothing to complain > > > about implementation-wise, I'm a bit

Re: allow online change primary_conninfo

2020-03-27 Thread Alvaro Herrera
On 2020-Mar-27, Alvaro Herrera wrote: > On 2020-Mar-27, Alvaro Herrera wrote: > > > I pushed the wal_receiver_create_temp_slot bugfix, because I realized > > after looking for long enough at WalReceiverMain() that the code was > > beyond saving. I'll be pushing the rest of this later today. >

Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly

2020-03-27 Thread Justin Pryzby
On Thu, Mar 26, 2020 at 11:01:06PM -0500, Justin Pryzby wrote: > > Another issue is this: > > > +VACUUM ( FULL [, ...] ) [ TABLESPACE > > class="parameter">new_tablespace ] [ > > class="parameter">table_and_columns [, ...] ] > > As you mentioned in your v1 patch, in the other cases, "tablespace

Re: [PATCH] Incremental sort (was: PoC: Partial sort)

2020-03-27 Thread Tomas Vondra
On Fri, Mar 27, 2020 at 12:51:34PM -0400, James Coleman wrote: In a previous email I'd summarized remaining TODOs I'd found. Here's an updated listed with several resolved. Resolved: 2. Not marked in the patch, but in nodeIncrementalSort.c ExecIncrementalSort() I wonder if perhaps we should

Re: pgbench - refactor init functions with buffers

2020-03-27 Thread Alvaro Herrera
On 2020-Mar-27, Tom Lane wrote: > That being the case, I'd think a better design principle is "make your > new code look like the code around it", which would tend to weigh against > introducing StringInfo uses into pgbench when there's none there now and > a bunch of PQExpBuffer instead. So I

Re: pgbench - refactor init functions with buffers

2020-03-27 Thread Tom Lane
Fabien COELHO writes: >>> Ok. I find it strange to mix PQExpBuffer & StringInfo in the same file. >> Agreed, but we'd rather use StringInfo going forward. However, I don't >> think >> that puts you on the hook for updating all the PQExpBuffer references. >> Unless you want to... > I cannot

Re: error context for vacuum to include block number

2020-03-27 Thread Amit Kapila
On Sat, Mar 28, 2020 at 12:34 AM Justin Pryzby wrote: > > On Fri, Mar 27, 2020 at 11:50:30AM +0530, Amit Kapila wrote: > > > > The crash scenario I'm trying to avoid would be like statement_timeout > > > > or other > > > > asynchronous event occurring between two non-atomic operations. > > > > >

Re: Online checksums verification in the backend

2020-03-27 Thread Masahiko Sawada
On Wed, 18 Mar 2020 at 19:11, Julien Rouhaud wrote: > > On Wed, Mar 18, 2020 at 07:06:19AM +0100, Julien Rouhaud wrote: > > On Wed, Mar 18, 2020 at 01:20:47PM +0900, Michael Paquier wrote: > > > On Mon, Mar 16, 2020 at 09:21:22AM +0100, Julien Rouhaud wrote: > > > > On Mon, Mar 16, 2020 at

Re: [PATCH] Check operator when creating unique index on partition table

2020-03-27 Thread Guancheng Luo
> On Mar 26, 2020, at 01:00, Tom Lane wrote: > > Guancheng Luo writes: >> I found that things could go wrong in some cases, when the unique index and >> the partition key use different opclass. > > I agree that this is an oversight, but it seems like your solution is > overcomplicated and

Re: Berserk Autovacuum (let's save next Mandrill)

2020-03-27 Thread Laurenz Albe
On Sat, 2020-03-28 at 11:59 +1300, David Rowley wrote: > On Fri, 27 Mar 2020 at 22:40, Laurenz Albe wrote: > > The new meaning of -2 should be documented, other than that it looks > > good to me. > > But the users don't need to know anything about -2. It's not possible > to explicitly set the

Re: error context for vacuum to include block number

2020-03-27 Thread Amit Kapila
On Sat, Mar 28, 2020 at 6:46 AM Justin Pryzby wrote: > > On Sat, Mar 28, 2020 at 06:28:38AM +0530, Amit Kapila wrote: > > > Hm, but I caused a crash *without* adding CHECK_FOR_INTERRUPTS, just > > > kill+sleep. The kill() could come from running pg_cancel_backend(). And > > > the > > > sleep()

Re: error context for vacuum to include block number

2020-03-27 Thread Amit Kapila
On Sat, Mar 28, 2020 at 7:04 AM Justin Pryzby wrote: > > On Sat, Mar 28, 2020 at 06:59:10AM +0530, Amit Kapila wrote: > > On Sat, Mar 28, 2020 at 6:46 AM Justin Pryzby wrote: > > > > > > On Sat, Mar 28, 2020 at 06:28:38AM +0530, Amit Kapila wrote: > > > > > Hm, but I caused a crash *without*

Re: WIP/PoC for parallel backup

2020-03-27 Thread Asif Rehman
On Wed, Mar 25, 2020 at 12:22 PM Rajkumar Raghuwanshi < rajkumar.raghuwan...@enterprisedb.com> wrote: > Hi Asif, > > While testing further I observed parallel backup is not able to take > backup of standby server. > > mkdir /tmp/archive_dir > echo "archive_mode='on'">> data/postgresql.conf > echo

Re: Unix-domain socket support on Windows

2020-03-27 Thread Andrew Dunstan
On 2/12/20 3:32 AM, Peter Eisentraut wrote: > Here is another patch set to enable this functionality. > > 0001 enables Unix-domain sockets on Windows, but leaves them turned > off by default at run time, using the mechanism introduced by > a9cff89f7e. This is relatively straightforward, except

Re: A bug when use get_bit() function for a long bytea string

2020-03-27 Thread Daniel Verite
Ashutosh Bapat wrote: > I think we need a similar change in byteaGetBit() and byteaSetBit() > as well. get_bit() and set_bit() as SQL functions take an int4 as the "offset" argument representing the bit number, meaning that the maximum value that can be passed is 2^31-1. But the maximum

Re: plan cache overhead on plpgsql expression

2020-03-27 Thread Tom Lane
I wrote: > Amit Langote writes: >> One thing -- I don't get the division between >> CachedPlanAllowsSimpleValidityCheck() and CachedPlanIsSimplyValid(). >> Maybe I am missing something, but could there not be just one >> function, possibly using whether expr_simple_expr is set or not to >> skip

Re: Allow auto_explain to log plans before queries are executed

2020-03-27 Thread legrand legrand
Kyotaro Horiguchi-4 wrote > At Thu, 27 Feb 2020 06:27:24 +0100, Pavel Stehule > pavel.stehule@ > wrote in >> odesílatel Kyotaro Horiguchi > horikyota.ntt@ > >> napsal: > > If we need a live plan dump of a running query, We could do that using > some kind of inter-backend triggering. (I'm

Re: psql FETCH_COUNT feature does not work with combined queries

2020-03-27 Thread David Steele
Hi Fabien, On 1/6/20 5:20 PM, Tomas Vondra wrote: On Fri, Jul 26, 2019 at 04:13:23PM +, Fabien COELHO wrote: FETCH_COUNT does not work with combined queries, and probably has never worked since 2006. For the record, this bug has already been reported & discussed by Daniel Vérité a few

Re: Patch: to pass query string to pg_plan_query()

2020-03-27 Thread legrand legrand
Tom Lane-2 wrote > Fujii Masao > masao.fujii@.nttdata > writes: >> Does anyone object to this patch? I'm thinking to commit it separetely >> at first before committing the planning_counter_in_pg_stat_statements >> patch. > > I took a quick look through

Re: shared-memory based stats collector

2020-03-27 Thread Alvaro Herrera
On 2020-Mar-27, Kyotaro Horiguchi wrote: > +/* > + * XLogArchiveWakeupEnd - Set up archiver wakeup stuff > + */ > +void > +XLogArchiveWakeupStart(void) > +{ > + Latch *old_latch PG_USED_FOR_ASSERTS_ONLY; > + > + SpinLockAcquire(>info_lck); > + old_latch = XLogCtl->archiverWakeupLatch;

Re: pgbench - refactor init functions with buffers

2020-03-27 Thread David Steele
On 11/6/19 12:48 AM, Fabien COELHO wrote: Hello Andres, Attached v3 shorten some lines and adds "append_tablespace". A v4 which just extends the patch to newly added 'G'. I'd prefer not to expand the use of pqexpbuffer in more places, and instead rather see this use StringInfo, now that's

Re: pgbench - rework variable management

2020-03-27 Thread David Steele
Hi Fabien, On 1/9/20 5:04 PM, Fabien COELHO wrote: Patch v4 is a just a rebase. Patch v5 is a rebase with some adjustements. This patch is failing on the Windows build: https://ci.appveyor.com/project/postgresql-cfbot/postgresql/build/1.0.85698 I'm not sure if this had been fixed in v3

Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM

2020-03-27 Thread Michail Nikolaev
Hello. > Probably, patch in this thread should fix this in btree_xlog_split() too? I have spent some time trying to find any possible race condition between btree_xlog_split and _bt_walk_left… But I can’t find any. Also, I have tried to cause any issue by putting pg_sleep put into

Re: INSERT ... OVERRIDING USER VALUE vs GENERATED ALWAYS identity columns

2020-03-27 Thread Dean Rasheed
On Fri, 27 Mar 2020 at 11:29, Peter Eisentraut wrote: > > We appear to have lost track of this. Ah yes, indeed! > I have re-read everything and > expanded your patch a bit with additional documentation and comments in > the tests. I looked that over, and it all looks good to me. Regards, Dean

Re: INSERT ... OVERRIDING USER VALUE vs GENERATED ALWAYS identity columns

2020-03-27 Thread Vik Fearing
On 3/27/20 9:33 AM, Dean Rasheed wrote: > On Fri, 27 Mar 2020 at 11:29, Peter Eisentraut > wrote: >> >> I have re-read everything and >> expanded your patch a bit with additional documentation and comments in >> the tests. > > I looked that over, and it all looks good to me. I concur. And it

<    1   2