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 1mKi0f-00030U-J1 for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 14:11:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKi0c-0008Sq-EV for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 14:11:34 +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 1mKi0c-0008Sh-5b for pgsql-general@lists.postgresql.org; Mon, 30 Aug 2021 14:11:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKi0X-0000BX-6r for pgsql-general@lists.postgresql.org; Mon, 30 Aug 2021 14:11:33 +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 17UEBMBv1349120; Mon, 30 Aug 2021 10:11:23 -0400 From: Tom Lane To: depesz@depesz.com cc: Laurenz Albe , pgsql-general Subject: Re: Can we get rid of repeated queries from pg_dump? In-reply-to: <20210830074442.GB15241@depesz.com> References: <20210826084430.GA26282@depesz.com> <648517.1629986527@sss.pgh.pa.us> <20210826140827.GA15868@depesz.com> <649446.1629987629@sss.pgh.pa.us> <20210826160644.GA3120@depesz.com> <896732.1630099403@sss.pgh.pa.us> <20210830074442.GB15241@depesz.com> Comments: In-reply-to hubert depesz lubaczewski message dated "Mon, 30 Aug 2021 09:44:43 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1349118.1630332682.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Aug 2021 10:11:22 -0400 Message-ID: <1349119.1630332682@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk hubert depesz lubaczewski writes: > On Fri, Aug 27, 2021 at 05:23:23PM -0400, Tom Lane wrote: >> I experimented with the attached, very quick-n-dirty patch to collect >> format_type results during the initial scan of pg_type, instead. > So, I applied it to brand new HEAD from git, Result: > From total of 9173 queries it went down to 4178. > Originally 5000 type queries, now 19! > This is actually strange given that previously it was asking querying > about 83 separate type oids. But, as far as I was able to check with > "pg_restore -l" (from -Fc dump), results are the same. Hm. So we're still no wiser than before about how such a small (in terms of number of objects) database could have produced so many getFormattedTypeName calls. Plus, this result raises a new question: with the patch, I think you shouldn't have seen *any* queries of that form. Where are the 19 survivors coming from? I don't suppose you could send me a schema-only dump of that database, off-list? I'm now quite curious. > But since we're looking at it, and with both patches applied, I looked > at the next most common query. Which is: > [ collection of details about a function ] > The thing is - even though it was called 1804 times, dump contains data = only > about 107 functions (pg_restore -l schema.dump | grep -c FUNCTION), so i= t kinda > seems that 94% of these calls is not needed. Hm. It's not doing that for *every* row in pg_proc, at least. I speculate that it is collecting and then not printing the info about functions that are in extensions --- can you check on how many there are of those? (Actually, if you've got a whole lot of objects inside extensions, maybe that explains the 5000 calls?) regards, tom lane