On 2016-03-22 10:40:28 -0400, Robert Haas wrote: > On Tue, Mar 22, 2016 at 6:52 AM, Andres Freund <and...@anarazel.de> 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 (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers