Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1IjN-00070s-7a for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2019 23:12:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i1IjL-0005MU-OO for pgsql-general@arkaria.postgresql.org; Fri, 23 Aug 2019 23:12:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i1IjL-0005MN-AW for pgsql-general@lists.postgresql.org; Fri, 23 Aug 2019 23:12:27 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i1IjI-0004bp-KQ for pgsql-general@postgresql.org; Fri, 23 Aug 2019 23:12:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C7E11203ED; Fri, 23 Aug 2019 19:12:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 23 Aug 2019 19:12:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=5 haON39B+37uSPbbaM2022jvHLpOXfHqA5QjttgNoUU=; b=B3UASWoaxhdbPIx9d HRF4PU3+cldkVBra+0y3fHNfUtZynOuXbBciw/46d0BYL2+tDA+3k5CF76qIE323 zDQeRdByTb1zHyorgV+D39GyJoICLLcRjglB7/DQaqeDO3LcUOvqCIzXCdVghVxC s07O27P5Pzh3Ay6PTzrbdM/hlr0Hp7gB1EvKp2lvNRAm3xOxIbrS+ufuH0rbBhWZ RqY7ChY043vIEFA+9QaCH0LjgTVNBcz6bCBfWfUHMlw/fkncm5IPyXbfEFmiildc 98ibtUk/vb9Aq+Vdy/ifD1AFeD/G53sOeW6trqund1yHwkL14+3Le8hu274l5qzz iTOsw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm3; bh=5haON39B+37uSPbbaM2022jvHLpOXfHqA5QjttgNo UU=; b=C0qcFfeP1zqzHoI0z+cqemdtrZzJQ4vU9kw16IhcfRanfCS+6ZI1Y/6PI Ox2TT7EE2pT7XA4CfN7INbowwhUf5/1/oCNarbUODlDNo2qKUqzDDWogdYv2kKkd ITJFKQFBC8DBhDR2dNlptLZZWDukSBLkesdmDevi+mTGhL63p2apN1asSPdOHPrX VIkUMlaby4kExL01q/eyxIZQFd27uxNNBOOxnQvGcth7NtjW61a5DkpA7oYy8s9F 47d2Spn8z7Q9IIJEBsd6WoN3wOwrz+rePGcP7bGF2JqAwa8p5RNpNQLZVNqMhLUN SGtLLCFmKGD3yNxRMxagdz3BinrCA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudegledgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdqrghrtghhihhvvgdrohhrghdpphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeej uddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirg hnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id EF9B4D6005A; Fri, 23 Aug 2019 19:12:22 -0400 (EDT) Subject: Re: slow queries on system tables To: PegoraroF10 , pgsql-general@postgresql.org References: <1565879436637-0.post@n3.nabble.com> <1565896167022-0.post@n3.nabble.com> <88609b1c-1653-6d4c-c1b4-883e109f5b93@aklaver.com> <1565963536657-0.post@n3.nabble.com> <19659.1565966519@sss.pgh.pa.us> <1565968275886-0.post@n3.nabble.com> <1566596875387-0.post@n3.nabble.com> <0eca5ab6-82cf-9768-6f09-0cb9998a1fdf@aklaver.com> <1566600424403-0.post@n3.nabble.com> From: Adrian Klaver Message-ID: Date: Fri, 23 Aug 2019 16:12:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1566600424403-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/23/19 3:47 PM, PegoraroF10 wrote: > This week we added just 5 new customers. Every schema has 100 tables, 300 > indices, 400 triggers. > I cannot imagine our script doing 75000 updates just for adding those > schemas. Very rough calculation: https://www.postgresql.org/docs/11/catalog-pg-class.html The catalog pg_class catalogs tables and most everything else that has columns or is otherwise similar to a table. This includes indexes (but see also pg_index), sequences (but see also pg_sequence), views, materialized views, composite types, and TOAST tables; see relkind. ... From above, not counting TOAST tables: 5 * (100 + 300) = 2,000 new entries. From previous post you said you had 190 schemas at that time. 190 * 400 = 76,000 entries + 2,000 78,000 In pg_class rel* fields: "It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX." Assuming tables/indexes have changed enough to trigger vacuum run: 78,000 * 1 vacuum = 78,000 updates > > > > > -- > Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html > > > -- Adrian Klaver adrian.klaver@aklaver.com