Re: [HACKERS] PATCH: Keep one postmaster monitoring pipe per process

2018-11-22 Thread Thomas Munro
On Sat, Nov 17, 2018 at 2:27 PM Thomas Munro wrote: > Thanks for the review. Pushed. -- Thomas Munro http://www.enterprisedb.com

Re: Accounting of zero-filled buffers in EXPLAIN (BUFFERS)

2018-11-22 Thread Thomas Munro
On Mon, Nov 19, 2018 at 5:24 PM Kyotaro HORIGUCHI wrote: > At Sat, 17 Nov 2018 11:15:54 -0300, Alvaro Herrera > wrote in <20181117141554.4dkx2u4j6md3bqdh@alvherre.pgsql> > > Is this patch committable now? > > I don't think so. We should make a decision on a point. > > I was a bit confused (sorry

Re: WIP: Avoid creation of the free space map for small tables

2018-11-22 Thread John Naylor
On 11/16/18, Amit Kapila wrote: I've attached v8, which includes the 2-state map and addresses the points below: > Some assorted comments: > 1. > > -Each heap and index relation, except for hash indexes, has a Free Space > Map > +Each heap relation, unless it is very small, and each index rela

Re: Inadequate executor locking of indexes

2018-11-22 Thread David Rowley
On Thu, 8 Nov 2018 at 13:14, Tom Lane wrote: > > I discovered that it's possible to trigger relation_open's new assertion > about having a lock on the relation by the simple expedient of running > the core regression tests with plan_cache_mode = force_generic_plan. > There are several things we

Re: Hitting CheckRelationLockedByMe() ASSERT with force_generic_plan

2018-11-22 Thread Tom Lane
David Rowley writes: > On Thu, 22 Nov 2018 at 22:33, Rushabh Lathia wrote: >> Now, to fix this issue either we need to hold proper lock before reaching >> to ExecInitIndexScan() or teach ExecInitIndexScan() to take AccessShareLock >> on the scan coming from CMD_DELETE. > I'd say the following co

Re: Should new partitions inherit their tablespace from their parent?

2018-11-22 Thread David Rowley
On Fri, 9 Nov 2018 at 06:58, Robert Haas wrote: > On Wed, Nov 7, 2018 at 9:43 PM Michael Paquier wrote: > > On Thu, Nov 08, 2018 at 12:50:40PM +1300, David Rowley wrote: > > > How about we record the tablespace option for the partitioned table in > > > reltablespace instead of saving it as 0. Ne

Re: Control your disk usage in PG: Introduction to Disk Quota Extension

2018-11-22 Thread Hubert Zhang
> > For this particular purpose, I don't immediately see why you need a > hook in both places. If ReadBuffer is called with P_NEW, aren't we > guaranteed to end up in smgrextend()? For the usercase in diskquota. BufferExtendCheckPerms_hook is used to do dynamic query enforcement, while smgr relat

Re: row filtering for logical replication

2018-11-22 Thread Stephen Frost
Greetings, * Euler Taveira (eu...@timbira.com.br) wrote: > 2018-02-28 21:54 GMT-03:00 Craig Ringer : > > Good idea. I haven't read this yet, but one thing to make sure you've > > handled is limiting the clause to referencing only the current tuple and the > > catalogs. user-catalog tables are OK,

Re: Add extension options to control TAP and isolation tests

2018-11-22 Thread Michael Paquier
On Thu, Nov 22, 2018 at 10:01:26PM +0300, Nikolay Shaplov wrote: > В письме от 21 ноября 2018 09:39:53 пользователь Michael Paquier написал: >> Those are mentioned here as part of the additional test suites: >> https://www.postgresql.org/docs/11/regress-run.html#id-1.6.20.5.5 > > Oh thanks (I feel

Re: Speeding up INSERTs and UPDATEs to partitioned tables

2018-11-22 Thread David Rowley
On Sat, 17 Nov 2018 at 07:28, Alvaro Herrera wrote: > > The 0002 patch is included again, this time with a new proposed commit > > message. There was some discussion over on [1] where nobody seemed to > > have any concerns about delaying the locking until we route the first > > tuple to the parti

Delay locking partitions during INSERT and UPDATE

2018-11-22 Thread David Rowley
As a follow-on from [1] and also discussed in [2], I'd like to propose that we don't obtain locks on all partitions during INSERT into a partitioned table and UPDATE of a partitioned key and instead, only lock the partition when we first route a tuple to it. This means that the order that the locks

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Haribabu Kommi
On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 19/11/2018 06:18, Haribabu Kommi wrote: > > Amit suggested another option in another mail, so total viable > > solutions that are discussed as of now are, > > > > 1. Single API with NULL input treat as

Re: row filtering for logical replication

2018-11-22 Thread Petr Jelinek
On 01/11/2018 01:29, Euler Taveira wrote: > Em qua, 28 de fev de 2018 às 20:03, Euler Taveira > escreveu: >> The attached patches add support for filtering rows in the publisher. >> > I rebased the patch. I added row filtering for initial > synchronization, pg_dump support and psql support. 0001 r

Re: [RFC] Removing "magic" oids

2018-11-22 Thread Andrew Dunstan
On 11/22/18 4:14 PM, Andres Freund wrote: Hi, On 2018-11-21 23:32:07 -0500, Andrew Dunstan wrote: On 11/21/18 7:14 PM, Andres Freund wrote: Could you check whether you still encounter the issue after applying the attached fix? This has largely fixed the problem, so I think this should

Re: Hitting CheckRelationLockedByMe() ASSERT with force_generic_plan

2018-11-22 Thread David Rowley
On Thu, 22 Nov 2018 at 22:33, Rushabh Lathia wrote: > CREATE TABLE foo (x int primary key); > INSERT INTO foo VALUES (1), (2), (3), (4), (5); > > CREATE OR REPLACE FUNCTION f1(a int) RETURNS int > AS $$ > BEGIN > DELETE FROM foo where x = a; > return 0; > END; > $$ LANGUAGE plpgsql; > > postgres

Re: [RFC] Removing "magic" oids

2018-11-22 Thread Andres Freund
Hi, On 2018-11-21 23:32:07 -0500, Andrew Dunstan wrote: > On 11/21/18 7:14 PM, Andres Freund wrote: > > Could you check whether you > > still encounter the issue after applying the attached fix? > > > > > This has largely fixed the problem, so I think this should be applied. Cool, will do so

Re: pg_upgrade supported versions policy

2018-11-22 Thread Andrew Dunstan
On 11/22/18 7:57 AM, Magnus Hagander wrote: On Thu, Nov 22, 2018 at 12:48 AM Andres Freund > wrote: Hi, I feel like we ought to trim the support for a few old versions from pg_upgrade.  In my particular case I don't really think it's reasonable t

Re: 64-bit hash function for hstore and citext data type

2018-11-22 Thread Andrew Gierth
> "Tomas" == Tomas Vondra writes: Tomas> I wonder if the hstore hash function is actually correct. I see Tomas> it pretty much just computes hash on the varlena representation. Tomas> The important question is - can there be two different encodings Tomas> for the same hstore value? I was

Re: Add extension options to control TAP and isolation tests

2018-11-22 Thread Nikolay Shaplov
В письме от 21 ноября 2018 09:39:53 пользователь Michael Paquier написал: > > For me name "output_iso" means nothing. iso is something about CD/DVD or > > about standards. I would not guess that iso stands for isolation if I did > > not know it already. isolation_output is more sensible: I have he

Re: 64-bit hash function for hstore and citext data type

2018-11-22 Thread Tomas Vondra
On 9/26/18 12:20 PM, amul sul wrote: Hi all, Commit[1] has added 64-bit hash functions for core data types and in the same discussion thread[2] Robert Haas suggested to have the similar extended hash function for hstore and citext data type. Attaching patch proposes the same. I wonder if the

Re: Tid scan improvements

2018-11-22 Thread Tomas Vondra
On 11/22/18 8:41 AM, David Rowley wrote: > ... 3. I'd rather see EnsureTidRangeSpace() keep doubling the size of the allocation until it reaches the required size. See how MakeSharedInvalidMessagesArray() does it. Doing it this way ensures we always have a power of two sized array which is much

Re: Online verification of checksums

2018-11-22 Thread Stephen Frost
Greetings, * Tomas Vondra (tomas.von...@2ndquadrant.com) wrote: > On 11/22/18 2:12 AM, Stephen Frost wrote: > >* Michael Banck (michael.ba...@credativ.de) wrote: > >>On Tue, Oct 30, 2018 at 06:22:52PM +0100, Fabien COELHO wrote: > >>>The "check if page was modified since checkpoint" does not look

Re: Online verification of checksums

2018-11-22 Thread Tomas Vondra
On 11/22/18 2:12 AM, Stephen Frost wrote: Greetings, * Michael Banck (michael.ba...@credativ.de) wrote: On Tue, Oct 30, 2018 at 06:22:52PM +0100, Fabien COELHO wrote: The "check if page was modified since checkpoint" does not look useful when offline. Maybe it lacks a comment to say that th

Re: New GUC to sample log queries

2018-11-22 Thread Vik Fearing
On 21/11/2018 09:06, Adrien Nayrat wrote: > On 11/19/18 2:52 PM, Dmitry Dolgov wrote: >>> On Mon, Nov 19, 2018 at 2:40 PM Tomas Vondra >>> wrote: >>> >>> On 11/19/18 2:57 AM, Michael Paquier wrote: On Sun, Nov 18, 2018 at 12:18:33PM +0100, Dmitry Dolgov wrote: > Since it's hard to come u

Re: using index or check in ALTER TABLE SET NOT NULL

2018-11-22 Thread Dmitry Dolgov
> On Tue, Nov 13, 2018 at 1:59 PM Alvaro Herrera > wrote: > > On 2018-Nov-13, Dmitry Dolgov wrote: > > > > On Sun, 4 Nov 2018 at 19:03, Sergei Kornilov wrote: > > > > > > > If not properly cataloguing NOT NULL constraints would be fixed, can it > > > > potentially conflict with the current patch

Re: MERGE SQL statement for PG12

2018-11-22 Thread Tomas Vondra
On 11/22/18 7:44 AM, Pavan Deolasee wrote: Hi Tomas, Sorry for a delayed response. On Mon, Oct 29, 2018 at 4:59 PM Tomas Vondra mailto:tomas.von...@2ndquadrant.com>> wrote: Hi Pavan, On 10/29/2018 10:23 AM, Pavan Deolasee wrote: > > ... > > Thanks for keeping an

Re: pg_upgrade supported versions policy

2018-11-22 Thread Robert Eckhardt
On Thu, Nov 22, 2018 at 7:57 AM Magnus Hagander wrote: > > On Thu, Nov 22, 2018 at 12:48 AM Andres Freund wrote: >> >> Hi, >> >> I feel like we ought to trim the support for a few old versions from >> pg_upgrade. In my particular case I don't really think it's reasonable >> to test < 9.0 version

Re: Implement predicate propagation for non-equivalence clauses

2018-11-22 Thread Alexander Kuzmenkov
Hi Richard, I took a look at the v2, here are some comments: * This feature needs tests, especially for the cases where opfamilies or data types or collations don't match, and other non-obvious cases where it shouldn't work. * Deducing an inequality to a constant is not always helpful. If w

Re: [HACKERS] generated columns

2018-11-22 Thread Peter Eisentraut
On 19/11/2018 19:54, Alvaro Herrera wrote: > It's unclear why you made generated columns on partitions unsupported. > I'd fix the limitation if possible, but if not, at least document it. This is explained here: + /* +* Generated columns in partition key expressions: +* +

Re: [HACKERS] generated columns

2018-11-22 Thread Peter Eisentraut
On 15/11/2018 15:10, Robert Haas wrote: > I don't have a strong position on 1 vs. 2 vs. 3, but I do think it > would be nicer not to use '\0' as a column value. I'd suggest you use > 'n' or '0' or '-' or some other printable character instead. I had carefully considered this when attidentity was

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Peter Eisentraut
On 19/11/2018 06:18, Haribabu Kommi wrote: > Amit suggested another option in another mail, so total viable  > solutions that are discussed as of now are, > > 1. Single API with NULL input treat as invalid value > 2. Multiple API to deal with NULL input of other values > 3. Single API with NULL va

Re: pg_upgrade supported versions policy

2018-11-22 Thread Peter Eisentraut
On 22/11/2018 00:47, Andres Freund wrote: > I can see a few possible policies: > > 1) Support upgrading from the set of releases that were supported when >the pg_upgrade target version was released. While some will argue that >this is fairly short, people above it can still upgrade ~10 yea

Re: ToDo: show size of partitioned table

2018-11-22 Thread Pavel Stehule
čt 22. 11. 2018 v 15:29 odesílatel Michael Paquier napsal: > On Thu, Nov 22, 2018 at 12:42:14PM +0100, Pavel Stehule wrote: > > Here my position is strong. \dP for me doesn't mean "tables or > > indexes" - it means "partition tables with total relation size". I > > don't see any sense to show tab

Re: ToDo: show size of partitioned table

2018-11-22 Thread Michael Paquier
On Thu, Nov 22, 2018 at 12:42:14PM +0100, Pavel Stehule wrote: > Here my position is strong. \dP for me doesn't mean "tables or > indexes" - it means "partition tables with total relation size". I > don't see any sense to show tables and indexes in one report. Please let me disagree on that point.

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Amit Kapila
On Thu, Nov 22, 2018 at 7:48 PM Amit Kapila wrote: > > On Thu, Nov 22, 2018 at 7:02 PM Alvaro Herrera > wrote: > > > > On 2018-Nov-20, Haribabu Kommi wrote: > > > > > > > 4. Single API with -1 as invalid value, treat NULL as no matching. > > > > > (Only > > > > problem > > > > > with this appr

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Amit Kapila
On Thu, Nov 22, 2018 at 7:02 PM Alvaro Herrera wrote: > > On 2018-Nov-20, Haribabu Kommi wrote: > > > > > 4. Single API with -1 as invalid value, treat NULL as no matching. (Only > > > problem > > > > with this approach is till now -1 is also a valid queryid, but setting > > > -1 as queryid > > >

Constraint documentation

2018-11-22 Thread Patrick Francelle
On 11/15/18 00:02, Tom Lane wrote: > I think this could be improved some more. Perhaps something like this > (I've not bothered with markup...) > > > This is a little verbose maybe, but as the text stands, it sounds like > using a trigger is enough to solve all the consistency problems that > a

Re: reg* checks in pg_upgrade are out of date

2018-11-22 Thread Andrew Dunstan
On 11/21/18 7:12 PM, Andres Freund wrote: Hi, It seems the list of reg* types and the check for them in pg_upgrade have gone out of sync. We have the following reg* types: SELECT typname FROM pg_type WHERE typname LIKE 'reg%' order by typname; ┌───┐ │typname│ ├──

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Alvaro Herrera
On 2018-Nov-20, Haribabu Kommi wrote: > > > 4. Single API with -1 as invalid value, treat NULL as no matching. (Only > > problem > > > with this approach is till now -1 is also a valid queryid, but setting > > -1 as queryid > > > needs to be avoided. > > > > Hmm, can we use 0 as default value wit

Re: [PATCH] btree_gist: fix union implementation for variable length columns

2018-11-22 Thread Pavel Raiskup
On Thursday, July 12, 2018 5:53:18 PM CET Teodor Sigaev wrote: > > It would be easier to figure this out if the btree_gist code weren't > > so desperately undocumented. Teodor, do you remember why it's like > > this? > > Will look. Ping on this issue. I guess the patch I proposed isn't wrong in

Re: [WIP] CREATE SUBSCRIPTION with FOR TABLES clause (table filter)

2018-11-22 Thread Evgeniy Efimkin
Hello! New draft attached with filtering table in subscription (ADD/DROP) and allow non-superusers use` CREATE SUBSCRIPTION` for own tables. 14.11.2018, 18:10, "Evgeniy Efimkin" : > Hello! > I started work on patch (draft attached). Draft has changes related only to > `CREATE SUBSCRIPTION`. > I

Re: [HACKERS] Time to change pg_regress diffs to unified by default?

2018-11-22 Thread Christoph Berg
Re: Noah Misch 2017-04-07 <20170407021431.gb2658...@tornado.leadboat.com> > > > I personally, and I know of a bunch of other regular contributors, find > > > context diffs very hard to read. Besides general dislike, for things > > > like regression test output context diffs are just not well suite

Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" test pending solution of its timing is (fwd)

2018-11-22 Thread Dmitry Dolgov
> On Thu, Jul 19, 2018 at 2:24 AM Fabien COELHO wrote: > > > Hello Heikki, > > >> [...] > >> So threadRun() would not have the opportunity to stop the scheduled > >> transaction, even if beyond the end of run, because it would not have got > >> out of doCustom, in the case I outlined above. > > >

Re: pg_upgrade supported versions policy

2018-11-22 Thread Magnus Hagander
On Thu, Nov 22, 2018 at 12:48 AM Andres Freund wrote: > Hi, > > I feel like we ought to trim the support for a few old versions from > pg_upgrade. In my particular case I don't really think it's reasonable > to test < 9.0 versions for pg_largeobject_metadata migrations. But I > think we should c

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Magnus Hagander
On Thu, Nov 22, 2018 at 4:10 AM Amit Kapila wrote: > On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi > wrote: > > > > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera > wrote: > >> > >> On 2018-Nov-19, Michael Paquier wrote: > >> > >> > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wro

Re: ToDo: show size of partitioned table

2018-11-22 Thread Pavel Stehule
čt 22. 11. 2018 v 1:51 odesílatel Michael Paquier napsal: > On Wed, Nov 21, 2018 at 05:37:33PM +0100, Pavel Stehule wrote: > > st 21. 11. 2018 v 17:21 odesílatel Alvaro Herrera < > alvhe...@2ndquadrant.com> > > napsal: > >> Hmm, these tests are not going to work, because they have "pavel" in the

Re: Control your disk usage in PG: Introduction to Disk Quota Extension

2018-11-22 Thread Haozhou Wang
Thank you very much for your review. We refactored our patch with new names and comments. For ReadBufferExtended hook, yes, Readbuffer with P_NEW will then call smgrextend. But in smgrextend, we cannot get the oid of a relation, and it will take some time to get the oid via smgrrelation. We would

Re: A WalSnd issue related to state WALSNDSTATE_STOPPING

2018-11-22 Thread Paul Guo
On Thu, Nov 22, 2018 at 1:29 PM Michael Paquier wrote: > On Wed, Nov 21, 2018 at 04:09:41PM +0900, Michael Paquier wrote: > > The checkpointer initializes a shutdown checkpoint where it tells to all > > the WAL senders to stop once all the children processes are gone, so it > > seems to me that t

Re: Ordered Partitioned Table Scans

2018-11-22 Thread David Rowley
On Mon, 5 Nov 2018 at 10:46, David Rowley wrote: > On 1 November 2018 at 22:05, Antonin Houska wrote: > > I think these conditions are too restrictive: > > > > /* > > * Determine if these pathkeys match the partition order, or reverse > > * partition order. It can't mat

tab-completion debug print

2018-11-22 Thread Kyotaro HORIGUCHI
Hello. I was reminded that I was often annoyed with identifying the code that made a word-completion, by hearing the same complaint from a collegue of mine just now. Something like the attached that tweaks completion_matches calls lets psql emit the line number where a word-completion happens. Th

Re: cursors with prepared statements

2018-11-22 Thread Dmitry Dolgov
> On Wed, Jul 18, 2018 at 10:27 AM Heikki Linnakangas wrote: > > On 16/07/18 15:56, Peter Eisentraut wrote: > > On 11.07.18 19:07, Heikki Linnakangas wrote: > >> It's confusing, and risks conflicting with future additions to > >> the standard. ECPG supports the actual standard syntax, with OPEN, >

Hitting CheckRelationLockedByMe() ASSERT with force_generic_plan

2018-11-22 Thread Rushabh Lathia
Hi, Commit b04aeb0a053e7cf7faad89f7d47844d8ba0dc839 add assertions that we hold some relevant lock during relation open as opening a relation with no lock at all is unsafe; With above commit below test case is failing and hitting the newly added Assert(). Test case: === CREATE TABLE foo

[Logical replication] Does the initial table data copy break the transactional replication?

2018-11-22 Thread Jinhua Luo
Hi All, When the publication adds new table, the main apply worker would skip changes upon that table and launches new sync worker to copy the existing data of that table, and if possible, the sync worker would apply changes since the copy start lsn. Then here comes the question, above logic spli

Re: performance statistics monitoring without spamming logs

2018-11-22 Thread Adrien NAYRAT
On 11/22/18 6:41 AM, Justin Pryzby wrote: and then probably look at the ratio of user CPU/clock time. Maybe pg_stat_kcache could help you : https://github.com/powa-team/pg_stat_kcache https://rjuju.github.io/postgresql/2018/07/17/pg_stat_kcache-2-1-is-out.html