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]



Reply via email to