Re: Optimizing TransactionIdIsCurrentTransactionId() - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Optimizing TransactionIdIsCurrentTransactionId()
Date
Msg-id 20191221151343.pmn27azsvkdebwk2@development
Whole thread Raw
In response to Re: Optimizing TransactionIdIsCurrentTransactionId()  (Simon Riggs <simon@2ndquadrant.com>)
List 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@sss.pgh.pa.us> wrote:
>
>> Simon Riggs <simon@2ndquadrant.com> writes:
>> > On Fri, 20 Dec 2019 at 13:07, Robert Haas <robertmhaas@gmail.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 



pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: Disallow cancellation of waiting for synchronous replication
Next
From: Tom Lane
Date:
Subject: Re: unsupportable composite type partition keys