Re: Whither 1:1?

From: Olivier Gautherot <olivier(at)gautherot(dot)net>
To: Guyren Howe <guyren(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Whither 1:1?
Date: 2018-06-01 17:16:29
Message-ID: CAJ7S9TXtVXxUHwWd0SEzjfUXbYzJObxren0LuoN+LXd2SBMQRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 1, 2018 at 12:52 PM, Guyren Howe <guyren(at)gmail(dot)com> wrote:

> It’s come to my attention that what seems an obvious and useful database
> design pattern — 1:1 relations between tables by having a shared primary
> key — is hardly discussed or used.
>
> It would seem to be a very simple pattern, and useful to avoid storing
> nulls or for groups of fields that tend to be used together.
>
> Thoughts? Is there some downside I can’t see?
>

You will get a benefit in terms of space only if the optional fields in the
second table exist in a reduced number of instances - and the second table
is significantly wider. This can make a difference on big tables but this
gain may be offset by the cost of the join. In this perspective, I don't
think that there is a clear benefit or drawback: it should be evaluated on
a case-by-case basis.

Olivier Gautherot

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guyren Howe 2018-06-01 17:25:40 Re: Whither 1:1?
Previous Message Tom Lane 2018-06-01 17:13:17 Re: RPM Packaging Question - Fedora 28 & Postgis