Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzTP0-0002oS-Q6 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 00:53:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzTOz-0001p7-71 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 00:53:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzTOy-0001os-Io for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 00:53:12 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mzTOr-00085m-8a for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 00:53:11 +0000 Received: by mail-ed1-x529.google.com with SMTP id bm14so32436871edb.5 for ; Mon, 20 Dec 2021 16:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=1OrKgSqHnkXnEeYbCM6TEwRF1PFOz4kn5qf3Y9x2ZP4=; b=ORSl/6oGD/RTQm3CGIhi+ygyvco+s4lJmDi1X9NYa6Wvzp/eHZGkxwTArvVfEt3LOn LO14D6aVI9NEGnDFT0Lxe9Fsv82e5AtVAS5WioKHb2Y4ywf+R+q4BGaE2l/20EJrjD0+ NRVa7Buzi2FyDHQKvE7UJoSGdr51/ZYM/iRgUJErzZdW1Gg0lAkfRf8bDv/XMyGUzcnJ +kHUeF2ljPIVfjbuGnjqhIm4qUI24hNW7W9h5FczHbzPLHU2ahN5lWo5hKJi/o0aybsZ An1BxIpGhefGz6mRnOuQhHbk7D7H2MRLRanZuhts2ccojzB8KWYwVWYsjYZPxli3FMr2 4tdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=1OrKgSqHnkXnEeYbCM6TEwRF1PFOz4kn5qf3Y9x2ZP4=; b=xlJ+O53kX475GM0QSzL6hQFziuByrxip+5BBVGAfO9aRK5l8549ART0G6yWmIVF1Pf ylDOhanNzhpvkarrQ4BcLZox4ualTy2qIhorUI/2Ev4y2bQlm5caEqVvQo0uvJ4uItwV EI4/PbAGLfswOKukQUuLFuZnts1rBpn8OQ0QSLI9AGIoiv2V3nNN3CfU9f4c/3VndSrO 4jriiuGTkKDeTYdHMGM+okdOurNUnzvRxJvzqSDhHIgG5sG7DZuUePtD/BN8zfQ84vAT CG9XCpreX2E4D4YZs29eHz7R5/RSdLgHy3yCpr/x2YVC+TLQ44k+esX/gK74Xp7KlGP2 szNQ== X-Gm-Message-State: AOAM532eCeoees2YRzd8EFlrBubuu5q39WpA0sB0YQJ7ZOdKzY0VrCFe 1vD+DwcX1Vax84DYc4nXXz6jqVa1rfCKX56T82Q4TGJjU0PvZNUv/ZQqM+ytVCnhIc+PRj+oFHM ciVudzqkHcEmdaiQSEroGKZMJcsr4AUf2nn9dB24LOV9INDfGHbLsVoVetetNfgccNuUwrWwGXf c84f9IIhUrPfxo31pomAvE+Rh9evHLNcuFwwNLBOtgbnaVKeF//GFzcIwZ1doH X-Google-Smtp-Source: ABdhPJwOFUNCYE2xg/MAh2rhbgasRIguxQixnaAcHpGll0TMjJ7C7dCB45hWLLKzskZ9/EuAEus+mA== X-Received: by 2002:a05:6402:38d:: with SMTP id o13mr687971edv.129.1640047983576; Mon, 20 Dec 2021 16:53:03 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id hs14sm3355358ejc.218.2021.12.20.16.53.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Dec 2021 16:53:03 -0800 (PST) Message-ID: <8231183d-1077-5394-1ffa-0c9d8c3905b0@enterprisedb.com> Date: Tue, 21 Dec 2021 01:53:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: sequences vs. synchronous replication Content-Language: en-US From: Tomas Vondra To: Peter Eisentraut , Tom Lane Cc: PostgreSQL Hackers References: <712cad46-a9c8-1389-aef8-faf0203c9be9@enterprisedb.com> <1452362.1639803168@sss.pgh.pa.us> <38a6a779-ee8d-de3c-fbd7-709285be88fa@enterprisedb.com> <7869761b-fdc7-6f7d-dc95-9ba8315a8ecf@enterprisedb.com> <1637476.1639862832@sss.pgh.pa.us> <8e24a470-b092-3c9f-0614-acd9df3f724f@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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