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