Re: Native Foreign Keys housekeeping time intensive for Relational Model - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: Native Foreign Keys housekeeping time intensive for Relational Model
Date
Msg-id 5d3f776063f41977df5910c6cdaef6b963342023.camel@cybertec.at
Whole thread Raw
In response to Re: Native Foreign Keys housekeeping time intensive for Relational Model  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
On Sat, 2021-03-27 at 10:43 -0400, Tom Lane wrote:
> Laurenz Albe <laurenz.albe@cybertec.at> writes:
> 
> > On Fri, 2021-03-26 at 14:00 -0400, Jacque Edmund wrote:
> > > I've already seen that my current set of FK relationships between < 100 tables and data footprint
> > > has yielded very large lookup times for the underlying referential integrity of the FKs to vet
> > > whether it can DELETE a row or not based on its FK relationships.
> 
> > I would be surprised if correctly indexed foreign keys would slow deletes down so that
> > the performance becomes intolerable.
> 
> Deletes being slow often means that you don't have an index on the
> referencing column(s).  PG requires you to have an index on the referenced
> columns, but not on the other side of the FK relationship.

Exactly, that's what I wanted to say: I suspect that such indexes are missing
or not created correctly.  Otherwise, the performance should be good.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Native Foreign Keys housekeeping time intensive for Relational Model
Next
From: Vivek Anandh
Date:
Subject: Re: Creating redwood datestyle in Postgres 12