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 1lXBtY-0001wf-PQ for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Apr 2021 23:59:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lXBtW-0007Ro-Ts for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Apr 2021 23:59:34 +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 1lXBtW-0007Rf-Mv for pgsql-hackers@lists.postgresql.org; Thu, 15 Apr 2021 23:59:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lXBtQ-0000sX-7g for pgsql-hackers@lists.postgresql.org; Thu, 15 Apr 2021 23:59:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 13FNxOn93965336; Thu, 15 Apr 2021 19:59:24 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org Subject: Re: Replacing pg_depend PIN entries with a fixed range check In-reply-to: <20210415234812.ylpcg3skayca7axw@alap3.anarazel.de> References: <3737988.1618451008@sss.pgh.pa.us> <20210415234812.ylpcg3skayca7axw@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 15 Apr 2021 16:48:12 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3965334.1618531164.1@sss.pgh.pa.us> Date: Thu, 15 Apr 2021 19:59:24 -0400 Message-ID: <3965335.1618531164@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > Hm, maybe we ought to swap template0 and template1 instead? I.e. have > template0 be in pg_database.dat and thus get a pinned oid, and then > create template1, postgres etc from that? No, *neither* of them are pinned, and we don't want them to be. It's something of a historical artifact that template1 has a low OID. >> + /* >> + * Large objects are never pinned. We need this special case because >> + * their OIDs can be user-assigned. >> + */ >> + if (classId == LargeObjectRelationId) >> + return false; > Huh, shouldn't we reject that when creating them? We've got regression tests that create blobs with small OIDs :-(. We could change those tests of course, but they're pretty ancient and I'm hesitant to move those goal posts. > I guess you didn't because of dump/restore concerns? That too. In short, I'm really skeptical of changing any of these pin-or-not decisions to save one or two comparisons in IsPinnedObject. That function is already orders of magnitude faster than what it replaces; we don't need to sweat over making it faster yet. regards, tom lane