pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Bulk inserts into two (related) tables
Date: Wed, 22 May 2019 11:58:52 -0700 (PDT)
Message-ID: <alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com> (raw)
In-Reply-To: <CAMa1XUg3mV8XijX_rVXGDqMyqe3gfbRrsE65xJqY9rS9VQFnYQ@mail.gmail.com>
References: <alpine.LNX.2.20.1905210945100.6551@salmo.appl-ecosys.com>
	<CA+bJJbyAsgWaxHvMBz3kTxWcekwGPv3yLXbKO4Yixgj5td25KQ@mail.gmail.com>
	<alpine.LNX.2.20.1905211022360.6551@salmo.appl-ecosys.com>
	<CA+bJJbwjTGmnTw55gvjbeNfutPY1Z-PsXoz_f7ycLDGac2SPxA@mail.gmail.com>
	<alpine.LNX.2.20.1905220535340.1484@salmo.appl-ecosys.com>
	<CAMa1XUgOeJ-TGX7DX-RrEzZUhdyLLykC6p+GFm70DeX6x9RavQ@mail.gmail.com>
	<alpine.LNX.2.20.1905220725100.1484@salmo.appl-ecosys.com>
	<CA+bJJbxkuX0=t8zyd2TV6Gf6xL1qXhLXstBm_koq63a7aK=i3w@mail.gmail.com>
	<alpine.LNX.2.20.1905220857540.1484@salmo.appl-ecosys.com>
	<CA+bJJbw5NxSE=hAKmT03RpOqdFuDDSvnzah7GpSxJU7ST8fjOA@mail.gmail.com>
	<alpine.LNX.2.20.1905221039260.1484@salmo.appl-ecosys.com>
	<CAMa1XUg3mV8XijX_rVXGDqMyqe3gfbRrsE65xJqY9rS9VQFnYQ@mail.gmail.com>

On Wed, 22 May 2019, Jeremy Finzel wrote:

> Are you saying your database already has an organizations table, and this
> data file is appending to it with all-brand-new organizations and people?

Jeremy,

The database has both organizations and people tables (among others) which
are already populated. The source file appends rows to both tables.

> Say you have 800 people. Are you honestly saying that there are also 800
> organizations? If so, I guess your solution would work. However, I thought
> that it was the case that multiple people belong to the same organization.
> Hence, the entire problem of mapping we have been discussing.

No. But, each organization may have several people, each one at a different
facility. Think of a bank with one headquarters but different mangers in
each of their branches.

> Also, you said previously that some fields from your data file would be
> populated in *both tables*. That is a fundamental violation of DB design.
> Why are you duplicating that data in two places?

Not if the duplicated data field is the primary key in the organizations
table and the referenced foreign key in the people table.

Regards,

Rich





view thread (32+ messages)  latest in thread

Message-ID: <alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com>
Permalink:  ../alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com/
Also on:    postgresql.org/message-id/alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: rshepard@appl-ecosys.com
  Subject: Re: Bulk inserts into two (related) tables
  In-Reply-To: <alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com>
  References: <alpine.LNX.2.20.1905210945100.6551@salmo.appl-ecosys.com> <CA+bJJbyAsgWaxHvMBz3kTxWcekwGPv3yLXbKO4Yixgj5td25KQ@mail.gmail.com> <alpine.LNX.2.20.1905211022360.6551@salmo.appl-ecosys.com> <CA+bJJbwjTGmnTw55gvjbeNfutPY1Z-PsXoz_f7ycLDGac2SPxA@mail.gmail.com> <alpine.LNX.2.20.1905220535340.1484@salmo.appl-ecosys.com> <CAMa1XUgOeJ-TGX7DX-RrEzZUhdyLLykC6p+GFm70DeX6x9RavQ@mail.gmail.com> <alpine.LNX.2.20.1905220725100.1484@salmo.appl-ecosys.com> <CA+bJJbxkuX0=t8zyd2TV6Gf6xL1qXhLXstBm_koq63a7aK=i3w@mail.gmail.com> <alpine.LNX.2.20.1905220857540.1484@salmo.appl-ecosys.com> <CA+bJJbw5NxSE=hAKmT03RpOqdFuDDSvnzah7GpSxJU7ST8fjOA@mail.gmail.com> <alpine.LNX.2.20.1905221039260.1484@salmo.appl-ecosys.com> <CAMa1XUg3mV8XijX_rVXGDqMyqe3gfbRrsE65xJqY9rS9VQFnYQ@mail.gmail.com> <alpine.LNX.2.20.1905221154441.1484@salmo.appl-ecosys.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox