Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvhh0-0006su-Sl for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Dec 2021 15:20:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mvhgy-0000wF-K3 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Dec 2021 15:20:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvhgy-0000w6-AY for pgsql-hackers@lists.postgresql.org; Fri, 10 Dec 2021 15:20:12 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvhgv-0005IQ-0c for pgsql-hackers@postgresql.org; Fri, 10 Dec 2021 15:20:11 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id CD4F840018; Fri, 10 Dec 2021 15:20:04 +0000 (UTC) Message-ID: <410c39ec-efd2-cb5f-8590-33d4fc0302d3@dunslane.net> Date: Fri, 10 Dec 2021 10:20:02 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Non-superuser subscription owners Content-Language: en-US To: Robert Haas , Amit Kapila Cc: Mark Dilger , Jeff Davis , PostgreSQL-development References: <9DFC88D3-1300-4DE8-ACBC-4CEF84399A53@enterprisedb.com> <1BB0A553-3FE9-4A91-A975-6F9D8C157FBD@enterprisedb.com> <7C62876F-5D19-4B5C-96AC-5590B10A49B2@enterprisedb.com> <66f55a6b9ff7bdd6bfd0d05e8fd8351690e69e23.camel@j-davis.com> <18b267939a9d1ae27e9b3643d53395f4e29ea6ce.camel@j-davis.com> <785e8b8ab06f123cf754862557bd3171aeba4d65.camel@j-davis.com> <7C8B9FA7-FECA-4C1C-9D0D-FCFE68C93EC3@enterprisedb.com> From: Andrew Dunstan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/10/21 09:09, Robert Haas wrote: > On Thu, Dec 9, 2021 at 11:15 PM Amit Kapila wrote: >> Yeah, to me also (b) sounds better than (a). However, a few points >> that we might want to consider in that regard are as follows: 1. >> locking the subscription for each transaction will add new blocking >> areas considering we acquire AccessExclusiveLock to change any >> property of subscription. But as Alter Subscription won't be that >> frequent operation it might be acceptable. > The problem isn't the cost of the locks taken by ALTER SUBSCRIPTION. > It's the cost of locking and unlocking the relation for every > transaction we apply. Suppose it's a pgbench-type workload with a > single UPDATE per transaction. You've just limited the maximum > possible apply speed to about, I think, 30,000 transactions per second > no matter how many parallel workers you use, because that's how fast > the lock manager is (or was, unless newer hardware or newer PG > versions have changed things in a way I don't know about). That seems > like a poor idea. There's nothing wrong with noticing changes at the > next transaction boundary, as long as we document it. So why would we > incur a possibly-significant performance cost to provide a stricter > guarantee? > > I bet users wouldn't even like this behavior. It would mean that if > you are replicating a long-running transaction, an ALTER SUBSCRIPTION > command might block for a long time until replication of that > transaction completes. I have a hard time understanding why anyone > would consider that an improvement. > +1 I think noticing changes at the transaction boundary is perfectly acceptable. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com