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 1mKiXs-000463-NP for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 14:45:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKiXr-0003is-MA for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 14:45:55 +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 1mKiXr-0003ij-By for pgsql-general@lists.postgresql.org; Mon, 30 Aug 2021 14:45:55 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKiXp-0006xv-9b for pgsql-general@lists.postgresql.org; Mon, 30 Aug 2021 14:45:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nS3O2wi68yxujlO8TUVIhx4JkTWdJ/IyllYJyz9bEyg=; b=l48oiZr+QUuyH8IaFqV5ReUV+8 QDc6bfmzZ5RsYKxHIS81pALC3VjKTgYPgFa82lCkSRrHemRIAMR/rR4USsSrRXB97kuij7C2KdFBY wGFJWHqmNzvY5BCXNuR3qvN55eo68bNSljWsLAxcSyOQl4X+T9oBo5KzqZaxS0prTJFg=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1mKiXn-0001k1-EA; Mon, 30 Aug 2021 16:45:51 +0200 Date: Mon, 30 Aug 2021 16:45:51 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Tom Lane Cc: Laurenz Albe , pgsql-general Subject: Re: Can we get rid of repeated queries from pg_dump? Message-ID: <20210830144551.GA27054@depesz.com> Reply-To: depesz@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> <1349119.1630332682@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1349119.1630332682@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Aug 30, 2021 at 10:11:22AM -0400, Tom Lane wrote: > I don't suppose you could send me a schema-only dump of that > database, off-list? I'm now quite curious. Asked the owners for their permission. > > 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 it 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?) Well, not sure if that's a lot, but: there are 15 extensions, including plpgsql. SELECT count(*) FROM pg_catalog.pg_depend WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND deptype = 'e'; return 2110 objects: SELECT classid::regclass, count(*) FROM pg_catalog.pg_depend WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND deptype = 'e' GROUP BY 1 ORDER BY 1; classid │ count ─────────────────────────┼─────── pg_type │ 31 pg_proc │ 1729 pg_class │ 61 pg_foreign_data_wrapper │ 1 pg_cast │ 30 pg_language │ 1 pg_opclass │ 73 pg_operator │ 111 pg_opfamily │ 73 (9 rows) Best regards, depesz