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.