Re: Arrays vs separate tables

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Arrays vs separate tables
Date: 2025-10-19 20:50:32
Message-ID: 57f94275-65ef-4e43-92e2-5fe3c7130e07@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/19/25 13:43, Rich Shepard wrote:

> In the former book I read that sometimes it's better to have multiple
> values
> for an atribute in a single row by creating a separate table for that
> attribute rather than using the postgres array capability. The people table
> in my database (1706 rows) has two attributes using the array type
> (direct_phone and email), and only a few indivuals have multiple landline
> phone numbers (cell_phone is a separate column) or email addresses (office
> and personal?). Would it make sense for me to create new landline and email
> address tables and replace the array contents?

For direct_phone and email entries that have more then one value, how do
you know what the values are pointing at e.g home vs office vs second
office location, etc?

>
> Other than remembering to use curly braces {} when entering data into an
> array column I don't think there'd be any performance benefit for making
> the
> change. I'm curious to learn about arrays vs separate tables.
>
> TIA,
>
> Rich
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ray O'Donnell 2025-10-19 20:53:10 Re: Arrays vs separate tables
Previous Message Rich Shepard 2025-10-19 20:43:09 Arrays vs separate tables