Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg5g7-00EQuI-4f for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Sep 2023 15:51:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qg5g6-009cuY-1d for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Sep 2023 15:51:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qg5g5-009cuE-KU for pgsql-hackers@lists.postgresql.org; Tue, 12 Sep 2023 15:51:49 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qg5g2-004AjO-E7 for pgsql-hackers@lists.postgresql.org; Tue, 12 Sep 2023 15:51:48 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bfb1167277so2877341fa.2 for ; Tue, 12 Sep 2023 08:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694533905; x=1695138705; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=shPaby2GJw/zNc5PSRUVBgCmeQtX9Dr9gm0rXoumqZc=; b=JFDp+gF7lBdDWM4I2Opfghm2dyQ6kGk7FBCU+rmHZIACi14ggeGSpa2+3LhnbCaLwB rS9YG+BuCG7lQ61gUyLXksjUZ0lh6tCuQZycy1OuHQa5lMVKleaNvNtq3ldP1DBlg1en 1StELqXCH9FX4g9xc+oiQOO4wK7BdD0PdQXp9MBA6NIo4uV+5Xcvz7UudIEBCI2Gi5tG Q50KLFov+ImECLcQB9+RIs4wv37h5Cnxdg+NH+sDLOCi828FB9SePN5pp3zoYRbeeNQo KGX8MGB57jtu8ONxbVGPDrGZsW8ppaqNg5G6MaQs/2ohztapsDEVAAszq3EiFmImfUll BsxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694533905; x=1695138705; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=shPaby2GJw/zNc5PSRUVBgCmeQtX9Dr9gm0rXoumqZc=; b=JcWlRHUqtZfw7/IPIdWomp9FOaZ4AiZczwTf4IkXmDwzL7Od0MEDfo77R43i5PHqb9 Bg+klUjY+hdj4xDsERvCuL4TETqVEDHyBWzRWat6yImY/iAmQPRn/K9zbXB5N8NnyAXw BSY/QeQBLDHeeiQTXsGMtbJIDKil9P0/+VXQlkK/NHckzbniib2lmMOWLWB1uVCW0bpR aNQYSAxPflKEThSOQ+99Azd5oe6JFdw2A/fnUspdOysr4OnQPn/XxWS8dsvKJYfOe4di Rhy5tquYiUkJqOSaTJ2KmgK/QlaWZDgVh0H9MZRnxvVDxGprXQRcEwYpAlImSlTJEJZs D8pw== X-Gm-Message-State: AOJu0YzmoOnIKNQzOPxUc+yCNtXe/R4RIgyn2vsoH/paikabnEyOw23w iiOd9Qs11CeZei1SqXGY+eWbzLSDV7bch26Hsqo= X-Google-Smtp-Source: AGHT+IEGjJzvdxAis/x3PGQcbw3ELI8aDhoLSVzyF5OJIT4wIqJYCIekRSQh+PBEvpAcmhcJNuRBHhS4hh7eG0HrnrU= X-Received: by 2002:a2e:8386:0:b0:2bc:e3a5:57aa with SMTP id x6-20020a2e8386000000b002bce3a557aamr174197ljg.0.1694533904467; Tue, 12 Sep 2023 08:51:44 -0700 (PDT) MIME-Version: 1.0 References: <20230901174330.6jbe4izkew4nlt7k@alvherre.pgsql> <564720.1693590749@sss.pgh.pa.us> In-Reply-To: <564720.1693590749@sss.pgh.pa.us> From: Matthias van de Meent Date: Tue, 12 Sep 2023 17:51:30 +0200 Message-ID: Subject: Re: GenBKI emits useless open;close for catalogs without rows To: Tom Lane Cc: Alvaro Herrera , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 1 Sept 2023 at 19:52, Tom Lane wrote: > > Alvaro Herrera writes: > > On 2023-Sep-01, Matthias van de Meent wrote: > >> A potential addition to the patch would to stop manually closing > >> relations: initdb and check-world succeed without manual 'close' > >> operations because the 'open' command auto-closes the previous open > >> relation (in boot_openrel). Testing also suggests that the last opened > >> relation apparently doesn't need closing - check-world succeeds > >> without issues (incl. with TAP enabled). That is therefore implemented > >> in attached patch 2 - it removes the 'close' syntax in its entirety. > > > Hmm, what happens with the last relation in the bootstrap process? Is > > closerel() called via some other path for that one? > > Taking a quick census of existing closerel() callers: there is > cleanup() in bootstrap.c, but it's called uncomfortably late > and outside any transaction, so I misdoubt that it works > properly if asked to actually shoulder any responsibility. > (A little code reshuffling could fix that.) > There are also a couple of low-level elog warnings in CREATE > that would likely get triggered, though I suppose we could just > remove those elogs. Yes, that should be easy to fix. > I guess my reaction to this patch is "why bother?". It seems > unlikely to yield any measurable benefit, though of course > that guess could be wrong. There is a small but measurable decrease in size of the generated bki (2kb with both patches, on an initial 945kB), and there is some related code that can be eliminated. If that's not worth bothering, then I can drop the patch. Otherwise, I can update the patch to do the cleanup that was within the transaction boundaries at the end of boot_yyparse. If decreasing the size of postgres.bki is not worth the effort, I'll drop any effort on doing so, but considering that it is about 1MB of our uncompressed distributables, I'd say decreases in size are worth the effort, most of the time. Kind regards, Matthias van de Meent