Re: Ideas to deal with table corruption - Mailing list pgsql-admin

From scott ribe
Subject Re: Ideas to deal with table corruption
Date
Msg-id D61E7ACB-FF21-4447-8580-AC27E3DD10B2@elevated-dev.com
Whole thread Raw
In response to Re: Ideas to deal with table corruption  (Corey Taylor <corey.taylor.fl@gmail.com>)
List pgsql-admin
On Jan 6, 2018, at 12:11 PM, Corey Taylor <corey.taylor.fl@gmail.com> wrote:
> Is it possible for an index to not exist on those columns?
>
> https://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-FK
>
> "A foreign key must reference columns that either are a primary key or form a unique constraint. This means that the
referencedcolumns always have an index (the one underlying the primary key or unique constraint); so checks on whether
areferencing row has a match will be efficient." 

One should also remember that the foreign key itself should usually be indexed, lest a delete on the referenced table
requirea table scan on the referencing table. 

--
Scott Ribe
https://www.linkedin.com/in/scottribe/
(303) 722-0567



pgsql-admin by date:

Previous
From: Corey Taylor
Date:
Subject: Re: Ideas to deal with table corruption
Next
From: Rui DeSousa
Date:
Subject: Re: Ideas to deal with table corruption