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 1tuxLm-00Esg8-HV for pgsql-general@arkaria.postgresql.org; Wed, 19 Mar 2025 17:37:06 +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 1tuxLk-008tNV-Iq for pgsql-general@arkaria.postgresql.org; Wed, 19 Mar 2025 17:37:04 +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 1tuxLk-008tNM-7t for pgsql-general@lists.postgresql.org; Wed, 19 Mar 2025 17:37:04 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tuxLg-003nrF-2s for pgsql-general@lists.postgresql.org; Wed, 19 Mar 2025 17:37:03 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5e6194e9d2cso12468273a12.2 for ; Wed, 19 Mar 2025 10:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742405821; x=1743010621; 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=2TTL3FYcxdSQVoEy+MwgdY7fjg5j7XXcFaZn0vqpvZg=; b=gNXdDLew41cAw6fY7yNUhEnBHCqyQHjEidfyWhlQrelKtiUKgQB5Up87k+TFiyWwso URTmLlQLTvOsThiL/SMANEOfZchfNMDGci0cz+MV8oif/CeSdJ8M2Zpy+Q8V6phZeyhr IgHJaGjyDR9nnP//kWxLnSeKAydMLRynEGKZ66PQIvJQ35tBXdK+eNupLnpDCeMFPQM5 amOs6zTHASNqzFf74jU0kyxZpwqGYNC1l7X3yBtvi4GTmgtVe0jKgrw08n/cZkx4/kPm 0V7o6yLxXTc8cjpAn4njZDEm3a0y3jxAJIjz93sB4S1Z86VvQGMOuoDO/wYCF0ux0B5C MQaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742405821; x=1743010621; 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=2TTL3FYcxdSQVoEy+MwgdY7fjg5j7XXcFaZn0vqpvZg=; b=Cs510Qk/S2mNGKXowsTKF50xRyk8V3J0EBYJ3prBrR/pO8Ix0/vdCQ778/bzoZPNcV ELR8pzafI/AM50IRlhhgwjpfpjCAF5L5y4fIhq8oa8R8emysIdRYRIcLdzyaMIH97KLY la+b/3SJMhOFvXLQPVOwk7hk1oSd2gN19xdqXEf2vt/avnNX6rDMcpaTTj1QJkN8wSu/ +iqdtngN9ghlQJi1zYvi1OCCInQMYO7muNs+vjV7Oj+0fGUV26o/Q1ILjn+uSlocM5Pj yhSa3mnUc18RiE2o0JNibS+FVqjwTvKRCCXDldJHylQBMObgmwk7SVreXgKG9G7CNmwH 3yVw== X-Gm-Message-State: AOJu0YxJBUuDmj0MwRB88Mdq00UAldGyeVCg7PNodmf29uK+nlrvCHt4 QqICD8u81fR+f0P+ThSoJLhlUq9Tvt/UrJMV5GQ5nK5J+28PpMrjd8sWYto2PGi8Pr7r4XTVqyl pe8chxt/DteT21YaXQn4CulEmTDi2DBObSYo= X-Gm-Gg: ASbGnctJLIc1gLX7UibwiROvy1EWfcm9H97j6XfC33/30LVqkJbIDbJ40D/NL3QDLAG iNm2+Gpz7uyWZzBbcifiOPln0+rLSn35swP+pqrNddanT+aGqHgC2N43/kxhl3SXApVO82Sfu/G 9h+ofhrhcm24UvFhmH7M14DoPryg== X-Google-Smtp-Source: AGHT+IEPypphTBKJkskGjK2Cd+tJrn0cSYw6A6STNnTs1gTRNFnfOzk809ogfsMOH+GFVeNPx/0cc2OJA4rAk6mqLCs= X-Received: by 2002:a05:6402:42ca:b0:5e7:b02b:5ae with SMTP id 4fb4d7f45d1cf-5eb80fa31e6mr2783479a12.31.1742405820952; Wed, 19 Mar 2025 10:37:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Siraj G Date: Wed, 19 Mar 2025 23:06:49 +0530 X-Gm-Features: AQ5f1JrssQ7DCtXVzcOD4ItDSUSfWjmw-TKvQE2SwcaSo1CRTPlySRe6cOvzjYs Message-ID: Subject: Re: size of attributes table is too big To: Adrian Klaver Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000033a2f0630b57835" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000033a2f0630b57835 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =3D (SELECT oid FROM pg_namespace WHERE nspname =3D '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. 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. On Wed, Mar 19, 2025 at 10:47=E2=80=AFPM 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. Ou= t > > 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 > > --000000000000033a2f0630b57835 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Adrian

Used this query to find the s= izes:

select=C2=A0=C2=A0relname AS object_name,rel= kind AS object_type,pg_size_pretty(pg_relation_size(oid)) AS object_sizeFROM pg_class=C2=A0WHERE relnamespace =3D (SELECT oid FROM pg_namespace WH= ERE nspname =3D 'pg_catalog')
ORDER BY pg_relation_size(oid) DES= C;

We have close to 2000 tables, not sure abou= t the columns. There should be around 120 - 150 tables that are active, get= ting the data from DMS.
We do not create/drop tables in our insta= nce unless required.

This is a cloud managed SQL a= nd we do not have any custom setting on the vacuum part.

On Wed, Mar 19, 2025 at 10:47=E2=80=AFPM Adrian Klaver <adrian.klaver@aklaver.com> wro= te:
On 3/19/25 1= 0:06, Siraj G wrote:
> Hello!
>
> I have a PG (v16) instance which is occupying around 1TB of storage. O= ut

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
>=C2=A0 =C2=A0 =C2=A0 =C2=A0
> 338 GB
> pg_attribute_relid_attnam_index
>=C2=A0 =C2=A0 =C2=A0 =C2=A0
> 117 GB
> pg_attribute_relid_attnum_index
>=C2=A0 =C2=A0 =C2=A0 =C2=A0
> 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.klave= r@aklaver.com

--000000000000033a2f0630b57835--