Re: [PATCH] Add features to pg_stat_statements

2020-11-25 Thread Fujii Masao
On 2020/11/25 15:40, Seino Yuki wrote: 2020-11-25 13:13 に Fujii Masao さんは書きました: On 2020/11/25 12:02, Seino Yuki wrote: 2020-11-17 01:46 に Fujii Masao さんは書きました: On 2020/11/16 12:22, Seino Yuki wrote: Thanks for updating the patch! +    pgss_info->dealloc = 0; +    SpinLockInit(&pgs

Re: Strange behavior with polygon and NaN

2020-11-25 Thread Kyotaro Horiguchi
At Wed, 25 Nov 2020 11:39:39 +0900 (JST), Kyotaro Horiguchi wrote in > > So that line of thought prompts me to tread *very* carefully when > > trying to dodge NaN results. We need to be certain that we > > introduce only logically-defensible special cases. Something like > > float8_coef_mul()

Re: Prevent printing "next step instructions" in initdb and pg_upgrade

2020-11-25 Thread Peter Eisentraut
On 2020-11-24 13:32, Magnus Hagander wrote: I think it boils down to that today the output from initdb is entirely geared towards people running initdb directly and starting their server manually, and very few people outside the actual PostgreSQL developers ever do that. But there are still a lot

Re: Multi Inserts in CREATE TABLE AS - revived patch

2020-11-25 Thread Luc Vlaming
On 23-11-2020 11:23, Bharath Rupireddy wrote: On Mon, Nov 23, 2020 at 3:26 PM Heikki Linnakangas wrote: On 23/11/2020 11:15, Bharath Rupireddy wrote: Attaching v2 patch, rebased on the latest master 17958972. I just broke this again with commit c532d15ddd to split up copy.c. Here's another

Re: Enumize logical replication message actions

2020-11-25 Thread Peter Smith
Hi Hackers. Last month there was a commit [1] for replacing logical replication message type characters with enums of equivalent values. I was revisiting this code recently and I think due to oversight that initial patch was incomplete. IIUC there are several more enum substitutions which should

Re: [PATCH] remove pg_standby

2020-11-25 Thread Peter Eisentraut
On 2020-11-21 20:41, Justin Pryzby wrote: On Fri, Nov 20, 2020 at 05:26:54PM +0100, Peter Eisentraut wrote: On 2020-10-29 03:44, Justin Pryzby wrote: diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml index 4e833d79ef..be4292ec33 100644 --- a/doc/src/sgml/contrib.sgml +++ b/doc/

Re: [HACKERS] logical decoding of two-phase transactions

2020-11-25 Thread Amit Kapila
On Wed, Nov 25, 2020 at 12:54 PM Peter Smith wrote: > > Hi Amit. > > IIUC the tablesync worker runs in a single transaction. > > Last week I discovered and described [1] a problem where/if (by > unlucky timing) the tablesync worker gets to handle the 2PC PREPARE > TRANSACTION then that whole singl

Re: Enumize logical replication message actions

2020-11-25 Thread Amit Kapila
On Wed, Nov 25, 2020 at 2:26 PM Peter Smith wrote: > > Hi Hackers. > > Last month there was a commit [1] for replacing logical replication > message type characters with enums of equivalent values. > > I was revisiting this code recently and I think due to oversight that > initial patch was incomp

Re: [patch] CLUSTER blocks scanned progress reporting

2020-11-25 Thread Fujii Masao
On 2020/11/25 0:25, Matthias van de Meent wrote: On Tue, 24 Nov 2020 at 15:05, Fujii Masao wrote: On 2020/11/21 2:32, Matthias van de Meent wrote: Hi, The pg_stat_progress_cluster view can report incorrect heap_blks_scanned values when synchronize_seqscans is enabled, because it allows th

Re: [POC] Fast COPY FROM command for the table with foreign partitions

2020-11-25 Thread Amit Langote
Hi, On Tue, Oct 20, 2020 at 11:31 AM tsunakawa.ta...@fujitsu.com wrote: > > > (2) > > > + Assert(rri->ri_usesMultiInsert == false); > > > > > > As the above assertion represents, I'm afraid the semantics of > > ExecRelationAllowsMultiInsert() and ResultRelInfo->ri_usesMultiInsert are > > unclea

Re: Use standard SIGHUP and SIGTERM handlers in autoprewarm module

2020-11-25 Thread Fujii Masao
On 2020/11/20 19:33, Bharath Rupireddy wrote: On Wed, Nov 18, 2020 at 5:52 PM Fujii Masao mailto:masao.fu...@oss.nttdata.com>> wrote: > > > handle_sigterm() and die() are similar except that die() has extra > > handling(below) for exiting immediately when waiting for input/command > > from

Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

2020-11-25 Thread Alexey Kondratov
On 2020-11-25 06:17, Bharath Rupireddy wrote: On Wed, Nov 25, 2020 at 7:24 AM Craig Ringer wrote: A quick thought here. Would it make sense to add a hook in the DISCARD ALL implementation that postgres_fdw can register for? There's precedent here, since DISCARD ALL already has the same eff

Re: Is postgres ready for 2038?

2020-11-25 Thread 方徳輝
Hi dear pgsql hackers Thanks for replies. There are no 32bit Windows version builds since Postgres 11, see: https://www.postgresql.org/download/windows/ but Postgres 13 still has the same 2038 problems. As @Pavel Borisov hints , I can find `_USE_32BIT_TIME_T` code here: https://github.com

Re: A few new options for CHECKPOINT

2020-11-25 Thread Bernd Helmle
Am Mittwoch, den 25.11.2020, 13:47 +0900 schrieb Michael Paquier: > I can see the use case for IMMEDIATE, but I fail to see the use cases > for WAIT and FORCE.  CHECKPOINT_FORCE is internally implied for the > end-of-recovery and shutdown checkpoints.  WAIT could be a dangerous > thing if disabled,

Re: Add statistics to pg_stat_wal view for wal related parameter tuning

2020-11-25 Thread Fujii Masao
On 2020/11/19 16:31, Masahiro Ikeda wrote: On 2020-11-17 11:46, Fujii Masao wrote: On 2020/11/16 16:35, Masahiro Ikeda wrote: On 2020-11-12 14:58, Fujii Masao wrote: On 2020/11/06 10:25, Masahiro Ikeda wrote: On 2020-10-30 11:50, Fujii Masao wrote: On 2020/10/29 17:03, Masahiro Ikeda wrot

Re: autovac issue with large number of tables

2020-11-25 Thread Masahiko Sawada
On Wed, Nov 25, 2020 at 4:18 PM Kasahara Tatsuhito wrote: > > Hi, > > On Wed, Nov 25, 2020 at 2:17 PM Masahiko Sawada wrote: > > > > On Fri, Sep 4, 2020 at 7:50 PM Kasahara Tatsuhito > > wrote: > > > > > > Hi, > > > > > > On Wed, Sep 2, 2020 at 2:10 AM Kasahara Tatsuhito > > > wrote: > > > > >

Re: [patch] CLUSTER blocks scanned progress reporting

2020-11-25 Thread Matthias van de Meent
On Wed, 25 Nov 2020 at 10:35, Fujii Masao wrote: > > On 2020/11/25 0:25, Matthias van de Meent wrote: > > > > I noticed that with my proposed patch it is still possible to go to > > the next phase while heap_blks_scanned != heap_blks_total. This can > > happen when the final heap pages contain onl

Re: Implementing Incremental View Maintenance

2020-11-25 Thread Konstantin Knizhnik
On 24.11.2020 13:11, Yugo NAGATA wrote: I wonder if it is possible to somehow use predicate locking mechanism of Postgres to avoid this anomalies without global lock? You mean that, ,instead of using any table lock, if any possibility of the anomaly is detected using predlock mechanism then

Re: Deleting older versions in unique indexes to avoid page splits

2020-11-25 Thread Victor Yegorov
ср, 25 нояб. 2020 г. в 05:35, Peter Geoghegan : > Then I had a much better idea: Make the existing LP_DEAD stuff a > little more like bottom-up index deletion. We usually have to access > heap blocks that the index tuples point to today, in order to have a > latestRemovedXid cutoff (to generate re

Re: SEARCH and CYCLE clauses

2020-11-25 Thread Peter Eisentraut
On 2020-10-10 07:25, Pavel Stehule wrote: This patch is based on transformation CYCLE and SEARCH clauses to specific expressions - it is in agreement with ANSI SQL There is not a problem with compilation Nobody had objections in discussion There are enough regress tests and documentation check-

Re: Implementing Incremental View Maintenance

2020-11-25 Thread Yugo NAGATA
On Wed, 25 Nov 2020 15:16:05 +0300 Konstantin Knizhnik wrote: > > > On 24.11.2020 13:11, Yugo NAGATA wrote: > > > >> I wonder if it is possible to somehow use predicate locking mechanism of > >> Postgres to avoid this anomalies without global lock? > > You mean that, ,instead of using any table

Re: Add Information during standby recovery conflicts

2020-11-25 Thread Masahiko Sawada
On Fri, Nov 20, 2020 at 6:18 PM Drouvot, Bertrand wrote: > > Hi, > > On 11/17/20 4:44 PM, Fujii Masao wrote: > > > > Thanks for updating the patch! Here are review comments. > > > > +Controls whether a log message is produced when the startup > > process > > +is waiting longer than

Re: [PATCH] LWLock self-deadlock detection

2020-11-25 Thread Ashutosh Bapat
On Wed, Nov 25, 2020 at 11:47 AM Craig Ringer wrote: >> I am also seeing a pattern >> Assert(!LWLockHeldByMe()); >> LWLockAcquire() >> >> at some places. Should we change LWLockAcquire to do >> Assert(!LWLockHeldByMe()) always to detect such occurrences? > > > I'm inclined not to, at least not wit

Re: Online checksums patch - once again

2020-11-25 Thread Heikki Linnakangas
On 25/11/2020 15:20, Daniel Gustafsson wrote: On 23 Nov 2020, at 18:36, Heikki Linnakangas wrote: What happens is if you crash between UpdateControlFile() and XlogChecksum()? Good point, that would not get the cluster to a consistent state. The XlogChecksum should be performed before controlf

Re: Parallel plans and "union all" subquery

2020-11-25 Thread Greg Nancarrow
On Wed, Nov 25, 2020 at 6:43 PM Luc Vlaming wrote: > > > You're completely right, sorry for my error. I was too quick on assuming > my patch would work for this specific case too; I should have tested > that before replying. It looked very similar but turns out to not work > because of the upper r

POC: Better infrastructure for automated testing of concurrency issues

2020-11-25 Thread Alexander Korotkov
Hackers, PostgreSQL is a complex multi-process system, and we are periodically faced with complicated concurrency issues. While the postgres community does a great job on investigating and fixing the problems, our ability to reproduce concurrency issues in the source code test suites is limited.

Re: POC: Cleaning up orphaned files using undo logs

2020-11-25 Thread Antonin Houska
Antonin Houska wrote: > Amit Kapila wrote: > > I think we also need to maintain oldestXidHavingUndo for CLOG truncation and > > transaction-wraparound. We can't allow CLOG truncation for the transaction > > whose undo is not discarded as that could be required by some other > > transaction. >

Re: Is postgres ready for 2038?

2020-11-25 Thread Pavel Borisov
> There are no 32bit Windows version builds since Postgres 11, see: > > https://www.postgresql.org/download/windows/ > > but Postgres 13 still has the same 2038 problems. > > > > As @Pavel Borisov hints , I can find `_USE_32BIT_TIME_T` code here: > > https://github.com/postgres/postgres/search?q=_

Re: POC: Cleaning up orphaned files using undo logs

2020-11-25 Thread Antonin Houska
Amit Kapila wrote: > On Wed, Nov 18, 2020 at 4:03 PM Antonin Houska wrote: > > > > Amit Kapila wrote: > > > > > On Fri, Nov 13, 2020 at 6:02 PM Antonin Houska wrote: > > > > > > > > Amit Kapila wrote: > > > > > > > > > On Thu, Nov 12, 2020 at 2:45 PM Antonin Houska > > > > > wrote: > > > >

Re: Use standard SIGHUP and SIGTERM handlers in autoprewarm module

2020-11-25 Thread Bharath Rupireddy
On Wed, Nov 25, 2020 at 3:29 PM Fujii Masao wrote: > > On 2020/11/20 19:33, Bharath Rupireddy wrote: > > On Wed, Nov 18, 2020 at 5:52 PM Fujii Masao mailto:masao.fu...@oss.nttdata.com>> wrote: > > > > > > > handle_sigterm() and die() are similar except that die() has extra > > > > handling(belo

Re: Improper use about DatumGetInt32

2020-11-25 Thread Anastasia Lubennikova
On 02.11.2020 18:59, Peter Eisentraut wrote: I have committed 0003. For 0001, normal_rand(), I think you should reject negative arguments with an error. I've updated 0001. The change is trivial, see attached. For 0002, I think you should change the block number arguments to int8, same as

Re: Implementing Incremental View Maintenance

2020-11-25 Thread Konstantin Knizhnik
On 25.11.2020 16:06, Yugo NAGATA wrote: On Wed, 25 Nov 2020 15:16:05 +0300 Konstantin Knizhnik wrote: On 24.11.2020 13:11, Yugo NAGATA wrote: I wonder if it is possible to somehow use predicate locking mechanism of Postgres to avoid this anomalies without global lock? You mean that, ,ins

Re: A few new options for CHECKPOINT

2020-11-25 Thread Laurenz Albe
On Wed, 2020-11-25 at 11:41 +0100, Bernd Helmle wrote: > Am Mittwoch, den 25.11.2020, 13:47 +0900 schrieb Michael Paquier: > > > I can see the use case for IMMEDIATE, but I fail to see the use cases > > for WAIT and FORCE. CHECKPOINT_FORCE is internally implied for the > > end-of-recovery and shu

Transaction isolation and table contraints

2020-11-25 Thread Konstantin Knizhnik
Hi hackers, I wonder if it is considered as correct behavior that transaction conflict detection depends on presence of primary key: create table t(pk integer, val integer); insert into t values (1,0),(2,0); Session1: begin isolation level serializable; Session2: begin isolation level seriali

Re: Prevent printing "next step instructions" in initdb and pg_upgrade

2020-11-25 Thread Magnus Hagander
On Wed, Nov 25, 2020 at 9:29 AM Peter Eisentraut wrote: > > On 2020-11-24 13:32, Magnus Hagander wrote: > > I think it boils down to that today the output from initdb is entirely > > geared towards people running initdb directly and starting their > > server manually, and very few people outside t

Re: Prevent printing "next step instructions" in initdb and pg_upgrade

2020-11-25 Thread Tom Lane
Magnus Hagander writes: > I guess one option could be to just remove it, unconditionally. And > assume that any users who is running it manually read that in docs > somewhere that tells them what to do next, and that any user who's > running it under a wrapper will have the wrapper set it up? I c

Re: PoC: custom signal handler for extensions

2020-11-25 Thread Anastasia Lubennikova
On 03.09.2020 14:25, Pavel Borisov wrote: Is there a chance to see you restarting working on this patch ? I noticed that despite interest to the matter, the discussion in this CF thread stopped quite a while ago. So I'd like to push here a patch revised according to the previous discussi

Re: A few new options for CHECKPOINT

2020-11-25 Thread Stephen Frost
Greetings, * Bossart, Nathan (bossa...@amazon.com) wrote: > On 11/24/20, 4:03 PM, "tsunakawa.ta...@fujitsu.com" > wrote: > > From: Bossart, Nathan > >> The main purpose of this patch is to give users more control over their > >> manually > >> requested checkpoints or restartpoints. I suspect

Re: Transaction isolation and table contraints

2020-11-25 Thread David G. Johnston
On Wed, Nov 25, 2020 at 8:14 AM Konstantin Knizhnik < k.knizh...@postgrespro.ru> wrote: > Hi hackers, > > I wonder if it is considered as correct behavior that transaction > conflict detection depends on presence of primary key: > > create table t(pk integer, val integer); > insert into t values (

Re: Improper use about DatumGetInt32

2020-11-25 Thread Peter Eisentraut
On 2020-11-02 16:59, Peter Eisentraut wrote: I have committed 0003. For 0001, normal_rand(), I think you should reject negative arguments with an error. I have committed a fix for that. For 0002, I think you should change the block number arguments to int8, same as other contrib modules do.

Re: Libpq support to connect to standby server as priority

2020-11-25 Thread Tom Lane
Greg Nancarrow writes: > On Wed, Nov 25, 2020 at 12:07 PM Tom Lane wrote: >> Here's a v2 that does it like that. > Looks OK to me. Thanks for looking! Pushed. At this point the cfbot is going to start complaining that the last-posted patch in this thread no longer applies. Unless you have a

Re: Prevent printing "next step instructions" in initdb and pg_upgrade

2020-11-25 Thread Bruce Momjian
On Wed, Nov 25, 2020 at 10:33:09AM -0500, Tom Lane wrote: > Magnus Hagander writes: > > I guess one option could be to just remove it, unconditionally. And > > assume that any users who is running it manually read that in docs > > somewhere that tells them what to do next, and that any user who's

Re: error_severity of brin work item

2020-11-25 Thread Justin Pryzby
On Mon, Nov 23, 2020 at 04:39:57PM -0300, Alvaro Herrera wrote: > I think this formulation (attached v3) has fewer moving parts. > > However, now that I did that, I wonder if this is really the best > approach to solve this problem. Maybe instead of doing this at the BRIN > level, it should be ha

Re: proposal: possibility to read dumped table's name from file

2020-11-25 Thread Dean Rasheed
On Thu, 19 Nov 2020 at 19:57, Pavel Stehule wrote: > > minor update - fixed handling of processing names with double quotes inside > I see this is marked RFC, but reading the thread it doesn't feel like we have reached consensus on the design for this feature. I agree that being able to configur

Re: Deleting older versions in unique indexes to avoid page splits

2020-11-25 Thread Peter Geoghegan
On Wed, Nov 25, 2020 at 4:43 AM Victor Yegorov wrote: >> Then I had a much better idea: Make the existing LP_DEAD stuff a >> little more like bottom-up index deletion. We usually have to access >> heap blocks that the index tuples point to today, in order to have a >> latestRemovedXid cutoff (to g

Re: walsender bug: stuck during shutdown

2020-11-25 Thread Alvaro Herrera
On 2020-Nov-25, Fujii Masao wrote: > But whether MyWalSnd->write is InvalidRecPtr or not, if it's behind sentPtr, > walsender should keep waiting for the ack to all the sent message to be > replied, i.e., isn't this expected behavior of normal shutdown? That is, > if we want to shutdown walsender

Re: [PATCH] Add `truncate` option to subscription commands

2020-11-25 Thread David Christensen
Hi, At this time I do not have time to make the necessary changes for this commitfest so I am voluntarily withdrawing this patch, but will revisit at a future time. Best, David On Wed, Oct 28, 2020 at 1:06 PM Rahila Syed wrote: > > Hi David, > > The feature seems useful to me. The code will n

Re: Improper use about DatumGetInt32

2020-11-25 Thread Alvaro Herrera
On 2020-Nov-25, Peter Eisentraut wrote: > bt_page_stats(PG_FUNCTION_ARGS) > { > text *relname = PG_GETARG_TEXT_PP(0); > - uint32 blkno = PG_GETARG_UINT32(1); > + int64 blkno = PG_GETARG_INT64(1); As a matter of style, I think it'd be better to have an int6

Re: [PATCH] Add section headings to index types doc

2020-11-25 Thread Tom Lane
=?UTF-8?Q?J=c3=bcrgen_Purtz?= writes: > Attached are two patches: a) summary against master and b) standalone of > my current changes. This was a bit confused ... as submitted, the patch wanted to commit a couple of patchfiles. I sorted it out I believe, and pushed with a little additional fidd

Re: proposal: possibility to read dumped table's name from file

2020-11-25 Thread Pavel Stehule
Hi st 25. 11. 2020 v 19:25 odesílatel Dean Rasheed napsal: > On Thu, 19 Nov 2020 at 19:57, Pavel Stehule > wrote: > > > > minor update - fixed handling of processing names with double quotes > inside > > > > I see this is marked RFC, but reading the thread it doesn't feel like > we have reached

Re: SEARCH and CYCLE clauses

2020-11-25 Thread Pavel Stehule
st 25. 11. 2020 v 14:06 odesílatel Peter Eisentraut < peter.eisentr...@2ndquadrant.com> napsal: > On 2020-10-10 07:25, Pavel Stehule wrote: > > This patch is based on transformation CYCLE and SEARCH clauses to > > specific expressions - it is in agreement with ANSI SQL > > > > There is not a probl

Re: enable_incremental_sort changes query behavior

2020-11-25 Thread James Coleman
On Tue, Nov 24, 2020 at 2:31 PM Tom Lane wrote: > > James Coleman writes: > > On Mon, Nov 23, 2020 at 2:24 PM Tom Lane wrote: > >> 1. James was wondering, far upthread, why we would do projections > >> pre-sort or post-sort. I think the answers can be found by studying > >> planner.c's make_sor

Re: proposal: possibility to read dumped table's name from file

2020-11-25 Thread Tom Lane
Pavel Stehule writes: > st 25. 11. 2020 v 19:25 odesílatel Dean Rasheed > napsal: >> I agree that being able to configure pg_dump via a config file would >> be very useful, but the syntax proposed here feels much more like a >> hacked-up syntax designed to meet this one use case, rather than a >>

Re: remove spurious CREATE INDEX CONCURRENTLY wait

2020-11-25 Thread Alvaro Herrera
On 2020-Nov-23, Andres Freund wrote: > On 2020-11-23 12:30:05 -0300, Alvaro Herrera wrote: > > In other words, my conclusion is that there definitely is a bug here and > > I am going to restore the use of exclusive lock for setting the > > statusFlags. > > Cool. Here's a patch. Note it also mo

Re: POC: postgres_fdw insert batching

2020-11-25 Thread Tomas Vondra
On 11/25/20 7:31 AM, tsunakawa.ta...@fujitsu.com wrote: > From: Craig Ringer >> I suggest that when developing this, you keep in mind the ongoing >> work on the libpq pipelining/batching enhancements, and also the >> way many interfaces to foreign data sources support asynchronous, >> concurrent o

Re: Add table access method as an option to pgbench

2020-11-25 Thread David Zhang
Thank a lot for your comments, Michael. On 2020-11-24 7:41 p.m., Michael Paquier wrote: On Tue, Nov 24, 2020 at 03:32:38PM -0800, David Zhang wrote: But, providing another option for the end user may not be a bad idea, and it might make the tests easier at some points. My first thought is that

Re: enable_incremental_sort changes query behavior

2020-11-25 Thread James Coleman
On Wed, Nov 25, 2020 at 2:53 PM James Coleman wrote: > > On Tue, Nov 24, 2020 at 2:31 PM Tom Lane wrote: > > > > James Coleman writes: > > > On Mon, Nov 23, 2020 at 2:24 PM Tom Lane wrote: > > >> 1. James was wondering, far upthread, why we would do projections > > >> pre-sort or post-sort. I

Re: Deleting older versions in unique indexes to avoid page splits

2020-11-25 Thread Victor Yegorov
ср, 25 нояб. 2020 г. в 19:41, Peter Geoghegan : > We have promising tuples for bottom-up deletion. Why not have > "promising heap blocks" for traditional LP_DEAD index tuple deletion? > Or if you prefer, we can consider index tuples that *don't* have their > LP_DEAD bits set already but happen to

Re: Optimising latch signals

2020-11-25 Thread Thomas Munro
On Thu, Nov 19, 2020 at 4:49 PM Thomas Munro wrote: > I'll add this to the next commitfest. Let's see if this version fixes the Windows compile error and warning reported by cfbot. From 3eb542891a11d39047b28f6f33ae4e3d25bdd510 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Sat, 8 Aug 2020 15:

Re: pg_dump, ATTACH, and independently restorable child partitions

2020-11-25 Thread Tom Lane
Justin Pryzby writes: > 1. Maybe pg_restore ExecuteSqlCommandBuf() should (always?) call > ExecuteSimpleCommands() instead of ExecuteSqlCommand(). It doesn't seem to > break anything (although that surprised me). That certainly does break everything, which I imagine is the reason why the cfbot s

Re: [patch] CLUSTER blocks scanned progress reporting

2020-11-25 Thread Fujii Masao
On 2020/11/25 20:52, Matthias van de Meent wrote: On Wed, 25 Nov 2020 at 10:35, Fujii Masao wrote: On 2020/11/25 0:25, Matthias van de Meent wrote: I noticed that with my proposed patch it is still possible to go to the next phase while heap_blks_scanned != heap_blks_total. This can happe

Re: Libpq support to connect to standby server as priority

2020-11-25 Thread Greg Nancarrow
On Thu, Nov 26, 2020 at 3:43 AM Tom Lane wrote: > > Thanks for looking! Pushed. > > At this point the cfbot is going to start complaining that the last-posted > patch in this thread no longer applies. Unless you have a new patch set > nearly ready to post, I think we should close the CF entry as

Re: Huge memory consumption on partitioned table with FKs

2020-11-25 Thread Keisuke Kuroda
Hi Hackers, Analyzed the problem and created a patch to resolve it. # Problem 1 When you create a foreign key to a partitioned table, referential integrity function is created for the number of partitions. Internally, SPI_prepare() creates a plan and SPI_keepplan() caches the plan. The more par

Re: Deleting older versions in unique indexes to avoid page splits

2020-11-25 Thread Peter Geoghegan
On Wed, Nov 25, 2020 at 1:20 PM Victor Yegorov wrote: > In the _bt_delete_or_dedup_one_page() we start with the simple loop over > items on the page and > if there're any LP_DEAD tuples, we're kicking off _bt_delitems_delete(). Right. > So if I understood you right, you plan to make this loop (

Re: Asynchronous Append on postgres_fdw nodes.

2020-11-25 Thread movead...@highgo.ca
I test the patch and occur several issues as blow: Issue one: Get a Assert error at 'Assert(bms_is_member(i, node->as_needrequest));' in ExecAppendAsyncRequest() function when I use more than two foreign table on different foreign server. I research the code and do such change then the Assert pr

Re: autovac issue with large number of tables

2020-11-25 Thread Kasahara Tatsuhito
On Wed, Nov 25, 2020 at 8:46 PM Masahiko Sawada wrote: > > On Wed, Nov 25, 2020 at 4:18 PM Kasahara Tatsuhito > wrote: > > > > Hi, > > > > On Wed, Nov 25, 2020 at 2:17 PM Masahiko Sawada > > wrote: > > > > > > On Fri, Sep 4, 2020 at 7:50 PM Kasahara Tatsuhito > > > wrote: > > > > > > > > Hi, >

Re: walsender bug: stuck during shutdown

2020-11-25 Thread Fujii Masao
On 2020/11/26 3:45, Alvaro Herrera wrote: On 2020-Nov-25, Fujii Masao wrote: But whether MyWalSnd->write is InvalidRecPtr or not, if it's behind sentPtr, walsender should keep waiting for the ack to all the sent message to be replied, i.e., isn't this expected behavior of normal shutdown? T

RE: POC: postgres_fdw insert batching

2020-11-25 Thread tsunakawa.ta...@fujitsu.com
From: Tomas Vondra > Well, good that we all agree this is a useful feature to have (in > general). The question is whether postgres_fdw should be doing batching > on it's onw (per this thread) or rely on some other feature (libpq > pipelining). I haven't followed the other thread, so I don't have

Re: Multi Inserts in CREATE TABLE AS - revived patch

2020-11-25 Thread Bharath Rupireddy
On Wed, Nov 25, 2020 at 2:11 PM Luc Vlaming wrote: > > Thanks for reviving the patch! I did unfortunately have to shift my > priorities somewhat and did not find much time to work on open source > things the last week(s). > Thanks for the comments. > > I'm wondering about the use of the GetTuple

RE: Parallel Inserts in CREATE TABLE AS

2020-11-25 Thread Hou, Zhijie
Hi, I have an issue about the following code: econtext = node->ps.ps_ExprContext; ResetExprContext(econtext); + if (ISCTAS(node->ps.intoclause)) + { + ExecParallelInsertInCTAS(node); + return NULL; + } /* If no projection is

Re: [PATCH] LWLock self-deadlock detection

2020-11-25 Thread Craig Ringer
On Wed, Nov 25, 2020 at 9:23 PM Ashutosh Bapat wrote: > On Wed, Nov 25, 2020 at 11:47 AM Craig Ringer > wrote: > >> I am also seeing a pattern > >> Assert(!LWLockHeldByMe()); > >> LWLockAcquire() > >> > >> at some places. Should we change LWLockAcquire to do > >> Assert(!LWLockHeldByMe()) always

RE: [POC] Fast COPY FROM command for the table with foreign partitions

2020-11-25 Thread tsunakawa.ta...@fujitsu.com
From: Amit Langote > Second is whether the interface for setting ri_usesMultiInsert > encourages situations where different modules could possibly engage in > conflicting behaviors. I can't think of a real-life example of that > with the current implementation, but maybe the interface provided in

Re: walsender bug: stuck during shutdown

2020-11-25 Thread Alvaro Herrera
On 2020-Nov-26, Fujii Masao wrote: > On the second thought, walsender doesn't wait forever unless > wal_sender_timeout is disabled, even in the case in discussion? > Or if there is the case where wal_sender_timeout doesn't work expectedly, > we might need to fix that at first. Hmm, no, it doesn't

Re: [PATCH] LWLock self-deadlock detection

2020-11-25 Thread Tom Lane
Craig Ringer writes: > On Wed, Nov 25, 2020 at 9:23 PM Ashutosh Bapat > wrote: >> I'd prefer to make the lock self deadlock check run for production >> builds, not just cassert builds. I'd like to register a strong objection to spending any cycles whatsoever on this. If you're using LWLocks in

Re: POC: Cleaning up orphaned files using undo logs

2020-11-25 Thread Amit Kapila
On Wed, Nov 25, 2020 at 8:00 PM Antonin Houska wrote: > > Amit Kapila wrote: > > > On Wed, Nov 18, 2020 at 4:03 PM Antonin Houska wrote: > > > > > > Amit Kapila wrote: > > > > > > > On Fri, Nov 13, 2020 at 6:02 PM Antonin Houska wrote: > > > > > > > > > > Amit Kapila wrote: > > > > > > > > >

RE: [Patch] Optimize dropping of relation buffers using dlist

2020-11-25 Thread k.jami...@fujitsu.com
On Thursday, November 19, 2020 4:08 PM, Tsunakawa, Takayuki wrote: > From: Andres Freund > > DropRelFileNodeBuffers() in recovery? The most common path is > > DropRelationFiles()->smgrdounlinkall()->DropRelFileNodesAllBuffers(), > > which 3/4 doesn't address and 4/4 doesn't mention. > > > > 4/4 se

Re: Huge memory consumption on partitioned table with FKs

2020-11-25 Thread Kyotaro Horiguchi
At Thu, 26 Nov 2020 09:59:28 +0900, Keisuke Kuroda wrote in > Hi Hackers, > > Analyzed the problem and created a patch to resolve it. > > # Problem 1 > > When you create a foreign key to a partitioned table, referential > integrity function is created for the number of partitions. > Internall

Re: POC: Cleaning up orphaned files using undo logs

2020-11-25 Thread Amit Kapila
On Wed, Nov 25, 2020 at 7:47 PM Antonin Houska wrote: > > Antonin Houska wrote: > > > Amit Kapila wrote: > > > > I think we also need to maintain oldestXidHavingUndo for CLOG truncation > > > and > > > transaction-wraparound. We can't allow CLOG truncation for the transaction > > > whose undo i

Re: Parallel Inserts in CREATE TABLE AS

2020-11-25 Thread Bharath Rupireddy
On Thu, Nov 26, 2020 at 7:47 AM Hou, Zhijie wrote: > > Hi, > > I have an issue about the following code: > > econtext = node->ps.ps_ExprContext; > ResetExprContext(econtext); > > + if (ISCTAS(node->ps.intoclause)) > + { > + ExecParallelInsertInCTAS(node);

Re: Multi Inserts in CREATE TABLE AS - revived patch

2020-11-25 Thread Michael Paquier
On Thu, Nov 26, 2020 at 07:24:01AM +0530, Bharath Rupireddy wrote: > Yeah. The tuple size may change after ExecCopySlot(). For instance, create > table t2 as select a1 from t1; where t1 has two integer columns a1, b1. I'm > creating t2 with single column a1 from t1 which makes the source slot > vir

Improving spin-lock implementation on ARM.

2020-11-25 Thread Krunal Bauskar
Improving spin-lock implementation on ARM. * Spin-Lock is known to have a significant effect on performance with increasing scalability. * Existing Spin-Lock implementation for ARM is sub-optimal due to use of TAS (test and swap) *

Re: Prevent printing "next step instructions" in initdb and pg_upgrade

2020-11-25 Thread Michael Paquier
On Wed, Nov 25, 2020 at 04:25:56PM +0100, Magnus Hagander wrote: > On Wed, Nov 25, 2020 at 9:29 AM Peter Eisentraut > wrote: >> Perhaps it's worth asking whom the advice applies to then. You suggest >> it's mostly developers. I for one am still grumpy that in 9.5 we >> removed the variant of th

Re: Enumize logical replication message actions

2020-11-25 Thread Amit Kapila
On Wed, Nov 25, 2020 at 2:52 PM Amit Kapila wrote: > > On Wed, Nov 25, 2020 at 2:26 PM Peter Smith wrote: > > > > Hi Hackers. > > > > Last month there was a commit [1] for replacing logical replication > > message type characters with enums of equivalent values. > > > > I was revisiting this code

Re: PoC: custom signal handler for extensions

2020-11-25 Thread Michael Paquier
On Wed, Nov 25, 2020 at 06:34:48PM +0300, Anastasia Lubennikova wrote: > I took a look at the patch. It looks fine and I see, that it contains fixes > for the latest questions in the thread. > > I think we should provide a test module for this feature, that will serve as > both test and example of

Re: Improving spin-lock implementation on ARM.

2020-11-25 Thread Michael Paquier
On Thu, Nov 26, 2020 at 10:00:50AM +0530, Krunal Bauskar wrote: > (Thanks to Amit Khandekar for rigorously performance testing this patch > with different combinations). For the simple-update and tpcb-like graphs, do you have any actual numbers to share between 128 and 1024 connections? The blue

Re: Improving spin-lock implementation on ARM.

2020-11-25 Thread Krunal Bauskar
scalability baseline patched ---- -- updatetpcb update tpcb -- 128 107932 78554 108081 78569 2568

Re: Improving spin-lock implementation on ARM.

2020-11-25 Thread Tom Lane
Michael Paquier writes: > On Thu, Nov 26, 2020 at 10:00:50AM +0530, Krunal Bauskar wrote: >> (Thanks to Amit Khandekar for rigorously performance testing this patch >> with different combinations). > For the simple-update and tpcb-like graphs, do you have any actual > numbers to share between 128

RE: [Patch] Optimize dropping of relation buffers using dlist

2020-11-25 Thread k.jami...@fujitsu.com
> From: k.jami...@fujitsu.com > On Thursday, November 19, 2020 4:08 PM, Tsunakawa, Takayuki wrote: > > From: Andres Freund > > > DropRelFileNodeBuffers() in recovery? The most common path is > > > DropRelationFiles()->smgrdounlinkall()->DropRelFileNodesAllBuffers() > > > , which 3/4 doesn't addre

Re: Improving spin-lock implementation on ARM.

2020-11-25 Thread Krunal Bauskar
On Thu, 26 Nov 2020 at 10:50, Tom Lane wrote: > Michael Paquier writes: > > On Thu, Nov 26, 2020 at 10:00:50AM +0530, Krunal Bauskar wrote: > >> (Thanks to Amit Khandekar for rigorously performance testing this patch > >> with different combinations). > > > For the simple-update and tpcb-like gr

Re: [doc] plan invalidation when statistics are update

2020-11-25 Thread torikoshia
On 2020-11-25 14:13, Fujii Masao wrote: On 2020/11/24 23:14, Fujii Masao wrote: On 2020/11/19 14:33, torikoshia wrote: On 2020-11-18 11:35, Fujii Masao wrote: Thanks for your comment! On 2020/11/18 11:04, torikoshia wrote: Hi, AFAIU, when the planner statistics are updated, generic plans

Re: Add table access method as an option to pgbench

2020-11-25 Thread Michael Paquier
On Wed, Nov 25, 2020 at 12:13:55PM -0800, David Zhang wrote: > The previous patch was based on branch "REL_13_STABLE". Now, the attached > new patch v2 is based on master branch. I followed the new code structure > using appendPQExpBuffer to append the new clause "using TABLEAM" in a proper > posit

Re: Multi Inserts in CREATE TABLE AS - revived patch

2020-11-25 Thread Bharath Rupireddy
On Thu, Nov 26, 2020 at 9:55 AM Michael Paquier wrote: > > +inline Size > +GetTupleSize(TupleTableSlot *slot, Size maxsize) > +{ > + Size sz = 0; > + HeapTuple tuple = NULL; > + > + if (TTS_IS_HEAPTUPLE(slot)) > + tuple = ((HeapTupleTableSlot *) slot)->tuple; > + else if(TTS_IS_BUFFE

Re: proposal: possibility to read dumped table's name from file

2020-11-25 Thread Pavel Stehule
st 25. 11. 2020 v 21:00 odesílatel Tom Lane napsal: > Pavel Stehule writes: > > st 25. 11. 2020 v 19:25 odesílatel Dean Rasheed < > dean.a.rash...@gmail.com> > > napsal: > >> I agree that being able to configure pg_dump via a config file would > >> be very useful, but the syntax proposed here fe

RE: Parallel Inserts in CREATE TABLE AS

2020-11-25 Thread Hou, Zhijie
Hi , > On Thu, Nov 26, 2020 at 7:47 AM Hou, Zhijie > wrote: > > > > Hi, > > > > I have an issue about the following code: > > > > econtext = node->ps.ps_ExprContext; > > ResetExprContext(econtext); > > > > + if (ISCTAS(node->ps.intoclause)) > > + { > > +

Re: Improving spin-lock implementation on ARM.

2020-11-25 Thread Amit Khandekar
On Thu, 26 Nov 2020 at 10:55, Krunal Bauskar wrote: > Hardware: ARM Kunpeng 920 BareMetal Server 2.6 GHz. 64 cores (56 cores for > server and 8 for client) [2 numa nodes] > Storage: 3.2 TB NVMe SSD > OS: CentOS Linux release 7.6 > PGSQL: baseline = Release Tag 13.1 > Invocation suite: > https://

Re: Multi Inserts in CREATE TABLE AS - revived patch

2020-11-25 Thread Luc Vlaming
On 26-11-2020 07:31, Bharath Rupireddy wrote: On Thu, Nov 26, 2020 at 9:55 AM Michael Paquier wrote: +inline Size +GetTupleSize(TupleTableSlot *slot, Size maxsize) +{ + Size sz = 0; + HeapTuple tuple = NULL; + + if (TTS_IS_HEAPTUPLE(slot)) + tuple = ((HeapTupleTableSlot *) slot)->t

Re: Add statistics to pg_stat_wal view for wal related parameter tuning

2020-11-25 Thread Masahiro Ikeda
On 2020-11-25 20:19, Fujii Masao wrote: On 2020/11/19 16:31, Masahiro Ikeda wrote: On 2020-11-17 11:46, Fujii Masao wrote: On 2020/11/16 16:35, Masahiro Ikeda wrote: On 2020-11-12 14:58, Fujii Masao wrote: On 2020/11/06 10:25, Masahiro Ikeda wrote: On 2020-10-30 11:50, Fujii Masao wrote: On

Have collation versioning to ignore hash and similar AM

2020-11-25 Thread Julien Rouhaud
Hello, Collation versioning has been committed, but there are still at least 2 cases that aren't perfectly handled: - AMs which don't rely on stable collation ordering (hash, bloom...) - expressions which don't rely on a stable collation ordering (e.g. md5()) Handling expressions will probably r

Re: Parallel plans and "union all" subquery

2020-11-25 Thread Luc Vlaming
On 25-11-2020 14:54, Greg Nancarrow wrote: On Wed, Nov 25, 2020 at 6:43 PM Luc Vlaming > wrote: > > > You're completely right, sorry for my error. I was too quick on assuming > my patch would work for this specific case too; I should have tested > that before repl

Stronger safeguard for archive recovery not to miss data

2020-11-25 Thread osumi.takami...@fujitsu.com
Hello The attached patch is intended to prevent a scenario that archive recovery hits WALs which come from wal_level=minimal and the server continues to work, which was discussed in the thread of [1]. The motivation is to protect that user ends up with both getting replica that could miss data an

  1   2   >