public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ray O'Donnell <[email protected]>
To: Rich Shepard <[email protected]>
To: [email protected]
Subject: Re: Arrays vs separate tables
Date: Sun, 19 Oct 2025 20:53:10 +0000
Message-ID: <01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On 19/10/2025 21: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?
>
My experience of doing something similar was that arrays work very well 
for the use-case you describe, as long as you don't have to search 
inside the arrays... I found that, if you have to search for a specific 
value inside an array, then performance really goes out the window. Mind 
you, clever use of an index would probably help here.

Ray.

-- 
Ray O'Donnell // Galway // Ireland
[email protected]







view thread (5+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Arrays vs separate tables
  In-Reply-To: <01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@eu-west-1.amazonses.com>

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

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