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 1n26PR-0005kj-Ar for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Dec 2021 06:56:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n26PO-0005Uz-OM for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Dec 2021 06:56:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n26PO-0005Uq-FE for pgsql-hackers@lists.postgresql.org; Tue, 28 Dec 2021 06:56:30 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n26PM-0000XC-7F for pgsql-hackers@lists.postgresql.org; Tue, 28 Dec 2021 06:56:30 +0000 Received: from [192.168.11.7] (p2638163-ipngn12701funabasi.chiba.ocn.ne.jp [180.59.132.163]) by oss.nttdata.com (Postfix) with ESMTPSA id 158056083F; Tue, 28 Dec 2021 15:56:23 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.4 at oss.nttdata.com Message-ID: Date: Tue, 28 Dec 2021 15:56:22 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: sequences vs. synchronous replication Content-Language: en-US To: Tomas Vondra , Kyotaro Horiguchi Cc: tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com, pgsql-hackers@lists.postgresql.org References: <20211224.143725.1750248643492340056.horikyota.ntt@gmail.com> <20211224.170451.116141220257426861.horikyota.ntt@gmail.com> <27f005a6-63f7-2ca9-2ab3-92fe9110e224@enterprisedb.com> From: Fujii Masao In-Reply-To: <27f005a6-63f7-2ca9-2ab3-92fe9110e224@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/12/24 19:40, Tomas Vondra wrote: > Maybe, but what would such workload look like? Based on the tests I did, such workload probably can't generate any WAL. The amount of WAL added by the change is tiny, the regression is caused by having to flush WAL. > > The only plausible workload I can think of is just calling nextval, and the cache pretty much fixes that. Some users don't want to increase cache setting, do they? Because - They may expect that setval() affects all subsequent nextval(). But if cache is set to greater than one, the value set by setval() doesn't affect other backends until they consumed all the cached sequence values. - They may expect that the value returned from nextval() is basically increased monotonically. If cache is set to greater than one, subsequent nextval() can easily return smaller value than one returned by previous nextval(). - They may want to avoid "hole" of a sequence as much as possible, e.g., as far as the server is running normally. If cache is set to greater than one, such "hole" can happen even thought the server doesn't crash yet. > FWIW I plan to explore the idea of looking at sequence page LSN, and flushing up to that position. Sounds great, thanks! Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION