From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: gowthamraj.kennedykannan@chainsys.com
Subject: BUG #18620: Problem: Slow Delete Operation
Date: Mon, 16 Sep 2024 18:54:50 +0000
Message-ID: <18620-69d2c91afdcf3f86@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18620
Logged by: gowtham
Email address: gowthamraj.kennedykannan@chainsys.com
PostgreSQL version: 15.6
Operating system: Windows
Description:
Problem: Slow Delete Operation
Issue: Deleting 4000 records from a parent table is taking more than 1
hour.
Database Structure:
Parent Table: Contains primary keys, referenced by foreign keys in child
tables.
Child Tables: 3 tables, each having foreign key constraints linked to the
parent table's primary keys.
Data Size: All tables contain over a million records.
Indexing: Indexes have been created on all primary keys in both the parent
and child tables.
Tested Scenarios:
Index Rebuilding: Rebuilding indexes on both the parent and child tables did
not improve the delete performance.
Recreating Parent Table: Recreating the parent table with the same data and
constraints also did not resolve the slowness issue.
Foreign Key Removal: When the foreign key constraints were removed from the
child tables, deleting 4000 records from the parent table took only a few
seconds. This suggests the foreign key checks are causing the slowness.
Requirement:
Improve the performance of the delete operation without removing the foreign
key constraints.
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-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, gowthamraj.kennedykannan@chainsys.com
Subject: Re: BUG #18620: Problem: Slow Delete Operation
In-Reply-To: <18620-69d2c91afdcf3f86@postgresql.org>
* 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