Re: which is better- storing data as array or json?

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: which is better- storing data as array or json?
Date: 2015-02-18 04:11:26
Message-ID: 54E410EE.9050609@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/17/2015 8:00 PM, zach cruise wrote:
> i can't keep creating tables or adding columns every time i need to
> add a nickname- this happens a lot.
>
> so i want to put everything in an array or json.
>
> remember rows can have different number of nicknames.

david was suggesting a join table.

one table with names (id, first name, last name, other attributes...)
with one row per person

and another table with (id, names_id, nickname, nickname attribute) with
as many rows as there are nicks and users...

you'd join these to get all the nicks for a given name, or to get all
the names for a given nickname, etc.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-02-18 04:14:05 Re: which is better- storing data as array or json?
Previous Message zach cruise 2015-02-18 04:00:37 Re: which is better- storing data as array or json?