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 1tuxX5-00EuD5-9z for pgsql-general@arkaria.postgresql.org; Wed, 19 Mar 2025 17:48:47 +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 1tuxX4-0099EJ-3J for pgsql-general@arkaria.postgresql.org; Wed, 19 Mar 2025 17:48:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tuxX3-0099EB-Nu for pgsql-general@lists.postgresql.org; Wed, 19 Mar 2025 17:48:45 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tuxX0-003txq-0E for pgsql-general@lists.postgresql.org; Wed, 19 Mar 2025 17:48:45 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2F76C11401FB; Wed, 19 Mar 2025 13:48:42 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 19 Mar 2025 13:48:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1742406522; x=1742492922; bh=ohFeZ+UNhT4LBASChAAn7wWRchvjTVC97kcavKG7Cyo=; b= gQ4F9syUbaunXG+Mnacz8wrN50qkwgocdmu6trHsTtgOA6nkfkRKosXhxURbyDgH zMk0Xow0oT7Hykt+2A5Wx1i16tGCl+KSeK619JxXja0beTCNV2SasVnO5NyV91ZP fEbR0fT3q5ctQ6mh1/Fyxx6s2z5coDCtrozLq3SCGk93Grp8RaR/zhvCYZBlJ9Tf 6B9B7/Q9J02q/7EjsPXC/M57gOaPERyLwpu11xJYmyb39TzdX1hg+bdb7NhHJ78i /wvhMPU+3C4byOWVdKs1ng5mnrBcyG9Hzxj7twwXVG9ars2buDGH709DH4IK+tSE Dq/FQtkOFPvljmMJO7xVgQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1742406522; x= 1742492922; bh=ohFeZ+UNhT4LBASChAAn7wWRchvjTVC97kcavKG7Cyo=; b=t Kg7HzMx4ApKYOanKoZJs06TLSPzOwKKwPyfNe/5p64qoTNbO6kttrJU7d1GD1Hrd idXNAMD3KA4fP6FZ/Oui9FVSFWg5WdbcrtqrVMR06InghqCw30xXl8HDX/bR7uTT c36kaRKYvzlyrgCOZquM/3OhAPhR5L7o9uBf8wvAufECnfmYcy2MK4LDZ5FikxAQ +lFUu7GYX1xVDEV8K6zg9Gfe7G8uSqRY61kW9mImsO/hn/KqbYU55WEszY6qsCdF Gxpu1uGyjc+zVzAGvQu5av199sKigyk6oeE57ZloiNpu1mezWj4wZe+JYNdXPN7w 5P9nCrj8uEXJv57cYa6Bg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeehleejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhirghnucfmlhgr vhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtf frrghtthgvrhhnpeefgeefieeutdfggfetgefgheekjeehteeileeigfetieekjedvieev iefgheevtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphht thhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehtohhsihhrrghjrdhgse hgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishht shdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Mar 2025 13:48:41 -0400 (EDT) Message-ID: <5164c593-3fa9-4b1a-9c5f-95d6d5393767@aklaver.com> Date: Wed, 19 Mar 2025 10:48:39 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: size of attributes table is too big To: Siraj G Cc: pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/19/25 10:36 AM, Siraj G wrote: > Hi Adrian > > Used this query to find the sizes: > > select  relname AS object_name,relkind AS > object_type,pg_size_pretty(pg_relation_size(oid)) AS object_size > FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE > nspname = 'pg_catalog') > ORDER BY pg_relation_size(oid) DESC; > > We have close to 2000 tables, not sure about the columns. There should > be around 120 - 150 tables that are active, getting the data from DMS. This would have been a good thing to have included in the original post. > We do not create/drop tables in our instance unless required. > > This is a cloud managed SQL and we do not have any custom setting on the > vacuum part. To be clear the issue is in the Google Cloud SQL instance? Or are you seeing the problem on the Postgres instance the data is coming from? > > On Wed, Mar 19, 2025 at 10:47 PM Adrian Klaver > > wrote: > > On 3/19/25 10:06, Siraj G wrote: > > Hello! > > > > I have a PG (v16) instance which is occupying around 1TB of > storage. Out > > Exact version of Postgres 16, include the x in 16.x. > > > of this, around 350GB is occupied by the table > pg_catalog.pg_attribute. > > Why is the catalog table's size so big? > > > > Here are the sizes: > > How did you measure the sizes? > > pg_attribute maintains information about table columns, how many table > columns do you have? > > Are you creating/dropping tables on a regular basis? > > Is autovacuum running properly? > > Have you run VACUUM manually on pg_attribute? > > > > > pg_attribute > > > > 338 GB > > pg_attribute_relid_attnam_index > > > > 117 GB > > pg_attribute_relid_attnum_index > > > > 69 GB > > > > > > I think this table must have tons of dead tuples. Please suggest > to me > > if we can purge any data/shrink the size of this table. > > > > REgards > > Siraj > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com