Re: Keep elog(ERROR) and ereport(ERROR) calls in the cold path

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2020-11-20T14:26:39Z
Lists: pgsql-hackers
On 2020-11-03 21:53, David Rowley wrote:
> On Tue, 3 Nov 2020 at 20:08, Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>>
>> On 2020-09-29 11:26, David Rowley wrote:
>>> I've marked this patch back as waiting for review. It would be good if
>>> someone could run some tests on some intel hardware and see if they
>>> can see any speedup.
>>
>> What is the way forward here?  What exactly would you like to have tested?
> 
> It would be good to see some small scale bench -S tests with and
> without -M prepared.
> 
> Also, small scale TPC-H tests would be good.    I really only did
> testing on new AMD hardware, so some testing on intel hardware would
> be good.

I did tests of elog_ereport_attribute_cold_v4.patch on an oldish Mac 
Intel laptop with pgbench scale 1 (default), and then:

pgbench -S -T 60

master:  tps = 8251.883229 (excluding connections establishing)
patched: tps = 9556.836232 (excluding connections establishing)

pgbench -S -T 60 -M prepared

master:  tps = 14713.821837 (excluding connections establishing)
patched: tps = 16200.066185 (excluding connections establishing)

So from that this seems like an easy win.

I also tested on a newish Mac ARM laptop, and there the patch did not do 
anything, but that was because clang does not support the cold 
attribute, so that part works as well. ;-)

-- 
Peter Eisentraut
2ndQuadrant, an EDB company
https://www.2ndquadrant.com/



Commits

  1. Stop gap fix for __attribute__((cold)) compiler bug in MinGW 8.1

  2. Tidy up definitions of pg_attribute_hot and pg_attribute_cold

  3. Fix unportable usage of __has_attribute

  4. Improve compiler code layout in elog/ereport ERROR calls

  5. Define pg_attribute_cold and pg_attribute_hot macros