From: Scott Ribe <scott_ribe@elevated-dev.com>
To: Sabyasachi Mukherjee <mukherjee.sabyasachi@outlook.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Observation with Postgres table size
Date: Fri, 10 May 2024 08:00:51 -0600
Message-ID: <A261A0D0-9868-4096-8F64-C966C8DB129C@elevated-dev.com> (raw)
In-Reply-To: <DB4PR10MB7469DCC3427E61FEEE2F8D6F8CE72@DB4PR10MB7469.EURPRD10.PROD.OUTLOOK.COM>
References: <DB4PR10MB7469DCC3427E61FEEE2F8D6F8CE72@DB4PR10MB7469.EURPRD10.PROD.OUTLOOK.COM>
> On May 10, 2024, at 7:57 AM, Sabyasachi Mukherjee <mukherjee.sabyasachi@outlook.com> wrote:
>
> Can any body please advise, how to reduce the size of the table?
VACUUM FULL
Read the docs to understand what it does. Deleting a row does not shrink the table.
Think about it, what happens when you delete a row that's first in the file on disk? Do you expect the rest of the table to be rewritten? Do you expect the file to be rewritten every time a row is deleted? On commit of any transaction that included a delete?
Postgres will eventually reuse the space left behind by deleted rows (read the docs for VACUUM), so under most use cases this is not a problem.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott_ribe@elevated-dev.com, mukherjee.sabyasachi@outlook.com, pgsql-admin@lists.postgresql.org
Subject: Re: Observation with Postgres table size
In-Reply-To: <A261A0D0-9868-4096-8F64-C966C8DB129C@elevated-dev.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox