Re: PG15 beta1 sort performance regression due to Generation context change

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: Andres Freund <andres(at)anarazel(dot)de>, David Rowley <dgrowleyml(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG15 beta1 sort performance regression due to Generation context change
Date: 2022-05-27 14:51:38
Message-ID: 2650080.1653663098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru> writes:
> В Вт, 24/05/2022 в 17:39 -0700, Andres Freund пишет:
>> A variation on your patch would be to only store the offset to the block
>> header - that should always fit into 32bit (huge allocations being their own
>> block, which is why this wouldn't work for storing an offset to the
>> context).

> I'm +1 for this.

Given David's results in the preceding message, I don't think I am.
A scheme like this would add more arithmetic and at least one more
indirection to GetMemoryChunkContext(), and we already know that
adding even a test-and-branch there has measurable cost. (I wonder
if using unlikely() on the test would help? But it's not unlikely
in a generation-context-heavy use case.) There would also be a good
deal of complication and ensuing slowdown created by the need for
oversize chunks to be a completely different kind of animal with a
different header.

I'm also not very happy about this:

> And with this change every memory context kind can have same header:

IMO that's a bug not a feature. It puts significant constraints on how
context types can be designed.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-05-27 15:55:02 Re: suboverflowed subtransactions concurrency performance optimize
Previous Message Tom Lane 2022-05-27 14:21:51 Re: "ERROR: latch already owned" on gharial