Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiNxo-0001RN-OQ for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Mar 2016 15:11:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aiNxo-0007oD-Ay for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Mar 2016 15:11:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1aiNxn-0007o7-AB for pgsql-hackers@postgresql.org; Tue, 22 Mar 2016 15:11:19 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiNxk-0004w7-Tc for pgsql-hackers@postgresql.org; Tue, 22 Mar 2016 15:11:18 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 00DD53B49FE; Tue, 22 Mar 2016 16:11:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (pD9F6A90D.dip0.t-ipconnect.de [217.246.169.13]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id AE9203B49FB; Tue, 22 Mar 2016 16:11:12 +0100 (CET) Received: by anarazel.de (Postfix, from userid 1000) id 1E96A101F8A; Tue, 22 Mar 2016 16:11:12 +0100 (CET) Date: Tue, 22 Mar 2016 16:11:12 +0100 From: Andres Freund To: Robert Haas Cc: Amit Kapila , David Steele , Thom Brown , Simon Riggs , Jesper Pedersen , pgsql-hackers Subject: Re: Speed up Clog Access by increasing CLOG buffers Message-ID: <20160322151112.GL3790@awork2.anarazel.de> References: <56E7032D.6060908@pgmasters.net> <20160322105221.GD3790@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-03-22 10:40:28 -0400, Robert Haas wrote: > On Tue, Mar 22, 2016 at 6:52 AM, Andres Freund wrote: > > I'm actually rather unconvinced that it's all that common that all > > subtransactions are on one page. If you have concurrency - otherwise > > there'd be not much point in this patch - they'll usually be heavily > > interleaved, no? You can argue that you don't care about subxacts, > > because they're more often used in less concurrent scenarios, but if > > that's the argument, it should actually be made. > > But a single clog page holds a lot of transactions - I think it's > ~32k. At 30-40k TPS/sec that's not actually all that much. > If you have 100 backends running, and each one allocates an XID > in turn, and then each allocates a sub-XID in turn, and then they all > commit, and then you repeat this pattern, >99% of transactions will be > on a single CLOG page. And that is a pretty pathological case. I think it's much more likely that some backends will immediately allocate and others won't for a short while. > It's true that if you have many short-running transactions interleaved > with occasional long-running transactions, and the latter use > subxacts, the optimization might fail to apply to the long-running > subxacts fairly often. But who cares? Those are, by definition, a > small percentage of the overall transaction stream. Leaving subtransactions aside, I think the problem is that if you're having slightly longer running transactions on a regular basis (and I'm thinking 100-200ms, very common on OLTP systems due to network and client processing), the effectiveness of the batching will be greatly reduced. I'll play around with the updated patch Amit promised, and see how high the batching rate is over time, depending on the type of transaction processed. Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers