| From: | Ray O'Donnell <ray(at)rodonnell(dot)ie> |
|---|---|
| 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:53:10 |
| Message-ID: | 01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@eu-west-1.amazonses.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
ray(at)rodonnell(dot)ie
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2025-10-19 21:44:19 | Re: Arrays vs separate tables |
| Previous Message | Adrian Klaver | 2025-10-19 20:50:32 | Re: Arrays vs separate tables |