Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pB9dl-0000ER-ML for pgsql-general@arkaria.postgresql.org; Fri, 30 Dec 2022 07:17:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pB9dk-0002Vs-6C for pgsql-general@arkaria.postgresql.org; Fri, 30 Dec 2022 07:17:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pB9di-0002Vj-VA for pgsql-general@lists.postgresql.org; Fri, 30 Dec 2022 07:17:15 +0000 Received: from mail-db3eur04olkn2058.outbound.protection.outlook.com ([40.92.74.58] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pB9dd-00036p-RI for pgsql-general@lists.postgresql.org; Fri, 30 Dec 2022 07:17:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a68+DdaqrQMRMbx73wpzL+UseV3OqSCV9f2gSJMdjOlr4zPrvpYbyoEaigJc5Iae6SH5p3PuUxSTSr/Gy2GSvdLuXZt56AITnibVtGOYUu0bWhWkEccCqawDyRcIP46Yl5fENlvqVqaE5bYajw7+UjEoT3y2B5V6Tlu6wnzkLdm/CEYDCNrP0oSc9gb0rGotJKW5ifG0WvUrOk+IcYcdx5su8Cnnpe0CKC2ic7ljfc5sB7yyJ3BgarVHrOyCh4eKO1gQTHwxo1/P1ggnm9oBwCM9wqCN7cehl2EDrClk/ZS04OmFQ6WFHHNjq32FK9e5UiGXHisu1UVnnTxQdsVP2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bebWRJzCJhs0WkaEYImPj+QzGSioScHAcRJyhwh6/TY=; b=G6sNCVRLPutinyAiHJRoPXEfPSekD+py3WnSmU3PVAO4OZkT1CXnaxocEPCBkPkFO5PasWqNYpHzvbkdNiuTqeNnrZOp+gqbIVB1gO3vAUUPyjS/Els2v+6QHL1Vo4tW8N0iHui7cAEVrZrXwzAtipfJzPiXjAuooBDuw+8BuszZNrqXkGgAk70rj1zNV1gBH72vOHR5I1C+pF+7zVRRnuHj5EUvul1/8MiRvKXqEe7SuKmsoarTk9OJhtWfXr1BOljKP0KxFKz7ftvs05gWbQ5dpnSKl/2Y7HBMg8an2WRfSFq6U1EMJl1pbwUtueegEcO5F1lxIeom4OEPHZjFJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bebWRJzCJhs0WkaEYImPj+QzGSioScHAcRJyhwh6/TY=; b=ALyZANShGPWjD1NYintid7ykao9Lua5UHYBR3DqoIbhhbEFTgED4XbKPE5R9ibLi4rKPeCE8nMUDyhGq1+hQ+fev1Bz4TvKkYTVcycsZuS6aq9LSHrelBrfzVNfvF21ceLjDvmSEg5A0UdKQYyhfJaMWdVhrFbuE7WQpfeZm2Q1nvMVgUUIKX3XEGNIm5v5RhlV9VQNU1hJnEAR1d5dw9k4m5caGT7FtPcl3m/XPq1HAbEHtSDE7Egkc+fe52xYa+z59ok4FdJYetFt+6OYlnSQe9cEa7bLyTQ3cwHm9PIOkHDXzjzDkyduV2gCqLAzV5mR+0TZf6G50N09y49qvfw== Received: from AM9P251MB0330.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:41c::6) by PRAP251MB0515.EURP251.PROD.OUTLOOK.COM (2603:10a6:102:292::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 07:17:06 +0000 Received: from AM9P251MB0330.EURP251.PROD.OUTLOOK.COM ([fe80::a60d:1561:b1ce:4b7a]) by AM9P251MB0330.EURP251.PROD.OUTLOOK.COM ([fe80::a60d:1561:b1ce:4b7a%9]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 07:17:06 +0000 From: Inzamam Shafiq To: Ranjith Paliyath , "pgsql-general@lists.postgresql.org" Subject: Re: Purging few months old data and vacuuming in production Thread-Topic: Purging few months old data and vacuuming in production Thread-Index: AdkcFQNaybGechHrTcqV6O+3EQHK6wACYqeo Date: Fri, 30 Dec 2022 07:17:06 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [eIHn+YvMiFNu1kBLi7THVY5v5/iTEdVa] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM9P251MB0330:EE_|PRAP251MB0515:EE_ x-ms-office365-filtering-correlation-id: a48bd81b-38ef-49ad-12a7-08daea35dbc3 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F/H6MsgcNxg0QN5IU3ysHGkyR71TcVJq1SY8MwqppxHXk+ws5HyNvmcazCKV/97qGYpnr6EBRngSfJvMAXqxD/ck/xU5JINL/LjesqMP2VyElVzl5tUTVZgDJyIaWVsa58kwSP5cXEB40LQy2o6V+FV9wPfUiM3VZnX+oaNsQGVUVyZXReFEUi6PqYuzftWd4cnfiqO4lD8maDpr9LzjLkhKFjTXAsbnq8dc89oXN1LC5mL5H1axzQQf6bhwBBtx8nk/l3Je40FMa2z3gw0/r4tQ/189UauuXqeWfL/Fyx8RG6Z1fR96c0qCX7Ai8PJHeQAgeUSP/cMu9seBmB+P6IR2fK74fB++k7RVA80mr1aweiErKdRwc1wTm2VT+GSPPxDPniIbcd+ZwMB7fFoJGoz3s56W3/0/e21E2W5EN9nRTGMz14mMpr/tZwkJeQPkk6+DIjssETDq8N1Hoeols9XuOgbsdi6pLM/wk2QKJhrGgSQs3jiOyzuso4B1anC253+NNOVY9cQxV/JiFLySfZekVkoNRFP8gD7EWgFuwEi+eynqewYxZYQX1a9yJW+3YQnK60FkvXc71OQHw/1LZwjjwxZH3W3bz9N+VKFU28vQeHdTOTfZdQ4HoPwmWamegg0rlBrlKl16rbUNmJLBsVPr9NJ39+040Kbsr2OhauY= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FvYdFIdFv6AgGOZUN0kAOuXb3yMUko15PDF+TWzRCoMS5CtdMkRvusnYtxKK?= =?us-ascii?Q?O0TtJkAXIupiU8Us534xByR0mIaSPhVCuJt+AHWYMfSO04tEWj49GkRweDA7?= =?us-ascii?Q?58SvUqJxKJjEzT4e10f8uXy/HrPexUZZ/31C+CCaLtnlCtjDpBLD5spal4ur?= =?us-ascii?Q?58IHJxZ+nDZEH0MxXhiOW51va387gbNAqo1B3dlt3CamJvgBKjl1VvB18Kvr?= =?us-ascii?Q?fQRFUjyIo9RYzYRtnTNbSTGZY35vcyGyZEhBCG1GAvAoxroAtfO/Uyhwt6zw?= =?us-ascii?Q?jkE/TUxBhJKwo8qQPKZ7Sv/QLX+cdjsJO5WEcyuuHCkINZVZ16WXCnfl6nEX?= =?us-ascii?Q?G5CepBv2zAbiH9MrETkQ1ZElslqcMBWMpRjVAjdpgCb1N88ymAv9i6bIqQpK?= =?us-ascii?Q?brcfIhiCA5I9ert9ohoNJgDcebqWvIMWUwZGngTzL3x9/61A0AAoozseh+nh?= =?us-ascii?Q?EOYtYubmQs8hzp34aW8eQ7nlWXwhYzlPh9UQA11KeGrEynhGsbjIOVH6H/zZ?= =?us-ascii?Q?aO7EDMcY2qAYS92zkT+DToVWiMBlVjkUTVNmoOMOiKwmuJ2d2b2z3ezTn434?= =?us-ascii?Q?zAfEJjk/hpC29WIUdYrWZTJsLOqPntwP7uBjeHIuiAi5kG5XP0TD817/xlof?= =?us-ascii?Q?1NSsd7fgLxD2QOUg+DuDAnQq2FoR/GjzRlrZzmtwFRBw2puxpXJkVnStHgVV?= =?us-ascii?Q?OOPHKF0ZWz8Oppww9CeJBdGL3XEIG0QnhUNlqUuL7gtg3KsWJtMszW1RKUPk?= =?us-ascii?Q?GZ3wB/6LZz8Vpx8smiqcly5k7CFEV7KS5WB6qso+fffGquyi0OLp4pAoZL8o?= =?us-ascii?Q?lU1VFLm1k2bLhD8Kja4FaqY6nQwUN139J2rN4u1Lks1bzfJaQN9BXbNDkJTq?= =?us-ascii?Q?VmDG9xneQ6wIutatIk29YxjszlowqFZG447niz5RLV/p7iIruLGBMfDjpBmI?= =?us-ascii?Q?2DJzE8y9yGSZbDPcQa+0bWHemkCnmb08ogFi49ApmimyEf6tNryawjURlzE/?= =?us-ascii?Q?X4qdnofeOVUfHzGXTuU7nAs7mmIb85b1O2TaUuYMc3yJKQfxD9JXBvSHhXIB?= =?us-ascii?Q?oUXlNXYszXMXF6rXzK01OLRpIoj3vndVG5kpP2iHSFqCcH53vlFv47Xvqfl3?= =?us-ascii?Q?YQv0p/GC4HVcSUHB59RlHl6MfoCeVQB0K8mbiPcMD/5HJrefHG/6aq9t7jlS?= =?us-ascii?Q?vXFoQdlgFvThpidr8vJr1XmDq/Rzq8mITW91aPg1csq+bx4sLftx7OA7b6Rg?= =?us-ascii?Q?+Bt5o3bFjA/FH4QL+68Nmyzx4w4xmMY1hK56zm6+Mg=3D=3D?= Content-Type: multipart/alternative; boundary="_000_AM9P251MB0330D75FD16DC0F46CCECC7498F09AM9P251MB0330EURP_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-00b75.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM9P251MB0330.EURP251.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: a48bd81b-38ef-49ad-12a7-08daea35dbc3 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Dec 2022 07:17:06.6882 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PRAP251MB0515 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --_000_AM9P251MB0330D75FD16DC0F46CCECC7498F09AM9P251MB0330EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, I think partitioning will be a good option, you can easily detach partition= s will minimal time. Regards, Inzamam Shafiq Sr. DBA ________________________________ From: Ranjith Paliyath Sent: Friday, December 30, 2022 11:39 AM To: 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 ta= bles 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 purg= e processing window is expected to be 2hrs. Observed test timing for deleti= on 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 pu= rge approach could then be a deletion/dropping of these partitions, which w= ould not really require a vacuuming later on. When we go for a Daily purge approach it should not put a strain on other p= rocesses which could be affecting this same set of tables, like these table= s should not get locked because of the purge. Questions are - (a) Should we recommend PostgreSQL upgrade, if possible, to v15.1? Could th= is 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 abo= ve. Any unauthorized use, printing, copying, disclosure or dissemination of= this communication may be subject to legal restriction or sanction. Accord= ingly, if you are not the intended recipient, please notify the sender by r= eplying to this email immediately and delete this email (and any attachment= thereto) from your computer system...Thank You. --_000_AM9P251MB0330D75FD16DC0F46CCECC7498F09AM9P251MB0330EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
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.postg= resql.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 ta= bles 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 d= eletion is exceeding 2-3hrs and we are trying to do vacuuming after the del= etes, which is again taking exceeding another 2hrs.
There is a suggestion for re-creating the tables with partitions, and as pu= rge approach could then be a deletion/dropping of these partitions, which w= ould not really require a vacuuming later on.

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

Questions are -
(a) Should we recommend PostgreSQL upgrade, if possible, to v15.1? Could th= is 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 abo= ve. 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 syste= m...Thank You.


--_000_AM9P251MB0330D75FD16DC0F46CCECC7498F09AM9P251MB0330EURP_--