Re: Arrays vs separate tables - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Arrays vs separate tables
Date
Msg-id 57f94275-65ef-4e43-92e2-5fe3c7130e07@aklaver.com
Whole thread Raw
In response to Arrays vs separate tables  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Arrays vs separate tables
List 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.klaver@aklaver.com



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Arrays vs separate tables
Next
From: Ray O'Donnell
Date:
Subject: Re: Arrays vs separate tables