From: | scott ribe <scott_ribe(at)elevated-dev(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org, pgsql-general General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Ideas to deal with table corruption |
Date: | 2018-01-06 19:14:56 |
Message-ID: | D61E7ACB-FF21-4447-8580-AC27E3DD10B2@elevated-dev.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
On Jan 6, 2018, at 12:11 PM, Corey Taylor <corey(dot)taylor(dot)fl(at)gmail(dot)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 referenced columns always have an index (the one underlying the primary key or unique constraint); so checks on whether a referencing 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 require a table scan on the referencing table.
--
Scott Ribe
https://www.linkedin.com/in/scottribe/
(303) 722-0567
From | Date | Subject | |
---|---|---|---|
Next Message | Rui DeSousa | 2018-01-06 19:59:04 | Re: Ideas to deal with table corruption |
Previous Message | Corey Taylor | 2018-01-06 19:11:44 | Re: Ideas to deal with table corruption |
From | Date | Subject | |
---|---|---|---|
Next Message | Rui DeSousa | 2018-01-06 19:59:04 | Re: Ideas to deal with table corruption |
Previous Message | Corey Taylor | 2018-01-06 19:11:44 | Re: Ideas to deal with table corruption |