Re: sequences vs. synchronous replication - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: sequences vs. synchronous replication
Date
Msg-id 8231183d-1077-5394-1ffa-0c9d8c3905b0@enterprisedb.com
Whole thread Raw
In response to Re: sequences vs. synchronous replication  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: sequences vs. synchronous replication  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 12/20/21 17:40, Tomas Vondra wrote:
> On 12/20/21 15:31, Peter Eisentraut wrote:
>> On 18.12.21 22:48, Tomas Vondra wrote:
>>> What do you mean by "not caching unused sequence numbers"? Reducing 
>>> SEQ_LOG_VALS to 1, i.e. WAL-logging every sequence increment?
>>>
>>> That'd work, but I wonder how significant the impact will be. It'd 
>>> bet it hurts the patch adding logical decoding of sequences quite a bit.
>>
>> It might be worth testing.  This behavior is ancient and has never 
>> really been scrutinized since it was added.
>>
> 
> OK, I'll do some testing to measure the overhead, and I'll see how much 
> it affects the sequence decoding patch.
> 

OK, I did a quick test with two very simple benchmarks - simple select 
from a sequence, and 'pgbench -N' on scale 1. Benchmark was on current 
master, patched means SEQ_LOG_VALS was set to 1.

Average of 10 runs, each 30 seconds long, look like this:

1) select nextval('s');

      clients          1         4
     ------------------------------
      master       39497    123137
      patched       6813     18326
     ------------------------------
      diff          -83%      -86%

2) pgbench -N

      clients          1         4
     ------------------------------
      master        2935      9156
      patched       2937      9100
     ------------------------------
      diff            0%        0%


Clearly the extreme case (1) is hit pretty bad, while the much mure 
likely workload (2) is almost unaffected.


I'm not sure what conclusion to make from this, but assuming almost no 
one does just nextval calls, it should be acceptable.


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: sqlsmith: ERROR: XX000: bogus varno: 2
Next
From: Ajin Cherian
Date:
Subject: Re: row filtering for logical replication