pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Inzamam Shafiq <inzamam.shafiq@hotmail.com>
To: Ranjith Paliyath <ranjithp@suntecgroup.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Purging few months old data and vacuuming in production
Date: Fri, 30 Dec 2022 07:17:06 +0000
Message-ID: <AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <SEZPR06MB569032257FDFACE5C906ADB4C2F09@SEZPR06MB5690.apcprd06.prod.outlook.com>
References: <SEZPR06MB569032257FDFACE5C906ADB4C2F09@SEZPR06MB5690.apcprd06.prod.outlook.com>

Hi,

I think partitioning will be a good option, you can easily detach partitions will minimal time.

Regards,

Inzamam Shafiq
Sr. DBA
________________________________
From: Ranjith Paliyath <ranjithp@suntecgroup.com>
Sent: Friday, December 30, 2022 11:39 AM
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Purging few months old data and vacuuming in production

Hi,

We have a PostgreSQL (slightly old version, something like - PostgreSQL 11.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit) production, where one particular table and its related 5 tables need to be purged of 3 months prior data. Each of these tables' daily record increment is on an average 2 to 3 million.

Approach needed is to do a daily purge of 90days prior data.  Probable purge processing window is expected to be 2hrs. Observed test timing for deletion is exceeding 2-3hrs and we are trying to do vacuuming after the deletes, which is again taking exceeding another 2hrs.
There is a suggestion for re-creating the tables with partitions, and as purge approach could then be a deletion/dropping of these partitions, which would not really require a vacuuming later on.

When we go for a Daily purge approach it should not put a strain on other processes which could be affecting this same set of tables, like these tables should not get locked because of the purge.

Questions are -
(a) Should we recommend PostgreSQL upgrade, if possible, to v15.1? Could this bring in some benefits related to vacuuming?
(b) Would partitioning be an optimal approach?

Thank you,
Regards


This electronic mail (including any attachment thereto) may be confidential and privileged and is intended only for the individual or entity named above. Any unauthorized use, printing, copying, disclosure or dissemination of this communication may be subject to legal restriction or sanction. Accordingly, if you are not the intended recipient, please notify the sender by replying to this email immediately and delete this email (and any attachment thereto) from your computer system...Thank You.

view thread (13+ messages)  latest in thread

Message-ID: <AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.COM>
Permalink:  ../AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.COM/
Also on:    postgresql.org/message-id/AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.COM

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: inzamam.shafiq@hotmail.com, ranjithp@suntecgroup.com
  Subject: Re: Purging few months old data and vacuuming in production
  In-Reply-To: <AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.COM>
  References: <SEZPR06MB569032257FDFACE5C906ADB4C2F09@SEZPR06MB5690.apcprd06.prod.outlook.com> <AM9P251MB0330D75FD16DC0F46CCECC7498F09@AM9P251MB0330.EURP251.PROD.OUTLOOK.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