Re: Optimizing TransactionIdIsCurrentTransactionId()

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Optimizing TransactionIdIsCurrentTransactionId()
Date: 2019-12-21 15:13:43
Message-ID: 20191221151343.pmn27azsvkdebwk2@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 20, 2019 at 05:57:55PM +0000, Simon Riggs wrote:
>On Fri, 20 Dec 2019 at 17:46, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
>> > On Fri, 20 Dec 2019 at 13:07, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> >> With regard to this point, I second Tomas's comments.
>>
>> > I also agree with Tomas' comments. I am explaining *why* it will be an
>> > improvement, expanding on my earlier notes.
>> > This function is called extremely frequently in query processing and is
>> > fairly efficient. I'm pointing out cases where making it even quicker
>> makes
>> > sense.
>>
>> I think the point is that you haven't demonstrated that this particular
>> patch makes it quicker.
>>
>
>Not yet, but I was trying to agree what an appropriate test would be before
>running it.
>

Isn't that a bit backwards? I mean, we usually identify opportunities
for optimizations by observing poor performance with a workload, which
means that workload can serve as a test. Of course, it's possible to
notice an opprtunity by eye-balling the code, but you've already said
this is supposed to improve read-only transactions.

I've actually tried to measure if/how this affects performance using a
simple read-only pgbench

pgbench -S -M prepared -T 60 test

I did this with a long-running transaction to prevent hint bits from
getting set. But I've not measured any difference in performane. So
either this improves a different workload, or maybe I'm doing something
silly that makes the patch irrelevant.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-12-21 17:02:15 Re: unsupportable composite type partition keys
Previous Message Andrey Borodin 2019-12-21 15:11:17 Re: Disallow cancellation of waiting for synchronous replication