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 1kfYwP-0000D6-Kb for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Nov 2020 01:40:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kfYwO-0000YO-HO for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Nov 2020 01:40:52 +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 1kfYwN-0000YH-L2 for pgsql-bugs@lists.postgresql.org; Thu, 19 Nov 2020 01:40:52 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfYwK-0003hH-6L for pgsql-bugs@lists.postgresql.org; Thu, 19 Nov 2020 01:40:51 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0D1BE5C017E; Wed, 18 Nov 2020 20:40:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 18 Nov 2020 20:40:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=m+Ni2vouvcMk7bHXDch9fbgAwwW bSng7QOmR9HjqKGM=; b=iqeOl5oXz0Bh58PDCylzn0jCNyOZs2rBHwxTx5E/TqF 5dROkAWmQuggg3SNYzDGKYrB/sRDevL0eNJk8IXZxtYys2pcGbnQ72uAMnCWSaZ8 mEkBjQ0nN8lDiJoZewxz1gOMbasojCf9W+yMyk9BFqy1tEw5EuL9RQZr8S5ZM9uY cEfBk3ZgapFDr+/hwIxgQeO2dF5m3hbzOrE2v+BpHwdfzCK6u6OnulbuteiB+1Ol lz2TRvWKlLiGfiEcMKHb2HXBlhsWlU0E2bY1FHeGkkEHRLLLigPxRwXrX2qKtBTd /iWLWWGnXiAFO1TU2okCPclC0hgKjFzucdi6Krshhzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=m+Ni2v ouvcMk7bHXDch9fbgAwwWbSng7QOmR9HjqKGM=; b=L4hyEwNC4LaSjAOYbquDUM DKjY8VGaKIsEMptyRD9nMyRugVxpEbk1VsnX490SOvhejtUz+Hk2gb6LfP6W9Z7Z 8DKp6RaUm7xCy3pqsQ869k6G/yIeUT3wvn/3oSw/XNbtjHQckstjY5xNudbr+884 NX76c7sJnBnoiot09baOPs+YnIdhByHsC5vmdcC7KFuUx+oMsdizYN/lWFX5xtsc uYmF4WQtH8Nk3ALWIN02Erb/wg4LWRCu4xLCdpUMBjV0qaaohyvSsaToRYCZUfCS HZCQLbVmGzu9Jukn/tb+e1tz8d45tJ/pYWF4hXfpTLE82QePTif5GwIsfNO9xpfw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudefiedgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucfkphepieejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id C97813280065; Wed, 18 Nov 2020 20:40:44 -0500 (EST) Date: Wed, 18 Nov 2020 17:40:43 -0800 From: Andres Freund To: Tom Lane Cc: Magnus Hagander , Fujii Masao , skoposov@ed.ac.uk, PostgreSQL mailing lists Subject: Re: BUG #16722: PG hanging on COPY when table has close to 2^32 toasts in the table. Message-ID: <20201119014043.mpf6g467hu55w7fc@alap3.anarazel.de> References: <16722-93043fb459a41073@postgresql.org> <95bfb4b5-2e0e-8ab7-12cf-03fae3367c52@oss.nttdata.com> <20201118192743.kr43onoxci5gexjx@alap3.anarazel.de> <20201118230529.6u7fyl6trnepekgc@alap3.anarazel.de> <1010421.1605744154@sss.pgh.pa.us> <20201119010637.uu5ub4qjnywytpt4@alap3.anarazel.de> <1013618.1605748675@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1013618.1605748675@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2020-11-18 20:17:55 -0500, Tom Lane wrote: > I'm not really on board with creating an actual sequence object for each > toast table. I don't think they are efficient enough. I'm not convinced that's true. Sure, nextval() could stand to be cheaper - but on the other hand, this would allow us to entirely avoid doing ahead-of-time uniqueness probes. Needing one extra WAL record every SEQ_LOG_VALS/32 toast insertions seems likely to be win over doing at least SEQ_LOG_VALS-1 additional uniqueness index probes. It's not like the oid counter is free of contention - one benefit of what I suggest would be that the potential contention point would move from system wide to table wide. I think reducing the rate of oid counter advancement is a significant benefit, moving the point of where we have to care about efficiency problems around system oid assignment costs quite a bit further into the future. I think there's also some small potential benefits around indexing in having densely allocated toast chunk ids for each toast table, over the sparser allocation we have right now. Greetings, Andres Freund