Re: Arrays vs separate tables

2025-10-20 Thread Michał Kłeczek
> On 20 Oct 2025, at 17:06, Rich Shepard wrote: > > On Mon, 20 Oct 2025, Michał Kłeczek wrote: > >> Do you have any means to make sure you didn’t enter the same number for >> two different companies then? > > Michal, > > Yes. New companies are added one-at-a-time. In the 28 years I've used

Re: Arrays vs separate tables

2025-10-20 Thread Rich Shepard
On Mon, 20 Oct 2025, Michał Kłeczek wrote: Do you have any means to make sure you didn’t enter the same number for two different companies then? Michal, Yes. New companies are added one-at-a-time. In the 28 years I've used postgres I've not had any such issues. Regards, Rich

Re: Arrays vs separate tables

2025-10-20 Thread Michał Kłeczek
> On 20 Oct 2025, at 16:26, Rich Shepard wrote: > > On Mon, 20 Oct 2025, Michał Kłeczek wrote: > >> How do you make sure a phone number is not shared by two (or more) >> customers? > > Michal, > > If it's the company's main telephone number then it's shared by all > employees with phones o

Re: Arrays vs separate tables

2025-10-20 Thread Rob Sargent
> On Oct 20, 2025, at 8:42 AM, Adrian Klaver wrote: > > On 10/20/25 07:07, Rich Shepard wrote: >>> On Mon, 20 Oct 2025, Michał Kłeczek wrote: >>> There is also another concern - do you want to make sure phone numbers are >>> not shared? >> Michal, >> Shared with whom? I run a solo professiona

Re: Arrays vs separate tables

2025-10-20 Thread Adrian Klaver
On 10/20/25 07:07, Rich Shepard wrote: On Mon, 20 Oct 2025, Michał Kłeczek wrote: There is also another concern - do you want to make sure phone numbers are not shared? Michal, Shared with whom? I run a solo professional services consultancy so there's only me here the database. That is t

Re: Arrays vs separate tables

2025-10-20 Thread Rich Shepard
On Mon, 20 Oct 2025, Ron Johnson wrote: Multiple contacts at the same client company. If, for whatever reason, the phone number changes you've got to update X rows in your contacts table, whereas only one row needs to be updated when the schema meets 1NF. This eliminates update anomalies. Ron,

Re: Arrays vs separate tables

2025-10-20 Thread Rich Shepard
On Mon, 20 Oct 2025, Michał Kłeczek wrote: How do you make sure a phone number is not shared by two (or more) customers? Michal, If it's the company's main telephone number then it's shared by all employees with phones on their desks. If it's a direct number then it connects to only a single

Re: Arrays vs separate tables

2025-10-20 Thread Ron Johnson
On Mon, Oct 20, 2025 at 10:07 AM Rich Shepard wrote: > On Mon, 20 Oct 2025, Michał Kłeczek wrote: > > > There is also another concern - do you want to make sure phone numbers > are > > not shared? > > Michal, > > Shared with whom? I run a solo professional services consultancy so there's > only m

Re: Arrays vs separate tables

2025-10-20 Thread Michał Kłeczek
> On 20 Oct 2025, at 16:07, Rich Shepard wrote: > > On Mon, 20 Oct 2025, Michał Kłeczek wrote: > >> There is also another concern - do you want to make sure phone numbers are >> not shared? > > Michal, > > Shared with whom? Sorry, I wasn’t clear. How do you make sure a phone number is not

Re: Arrays vs separate tables

2025-10-20 Thread Rich Shepard
On Mon, 20 Oct 2025, Michał Kłeczek wrote: There is also another concern - do you want to make sure phone numbers are not shared? Michal, Shared with whom? I run a solo professional services consultancy so there's only me here the database. Rich

Re: Arrays vs separate tables

2025-10-20 Thread Michał Kłeczek
> On 20 Oct 2025, at 14:55, Rich Shepard wrote: > > On Mon, 20 Oct 2025, Peter J. Holzer wrote: > >> * Simplicity: If a set of values is always fetched together and updated >> together, you might as well treat it as a unit and not split it over >> multiple tables > >> The second may be releva

Re: Arrays vs separate tables

2025-10-20 Thread Rich Shepard
On Mon, 20 Oct 2025, Peter J. Holzer wrote: * Simplicity: If a set of values is always fetched together and updated together, you might as well treat it as a unit and not split it over multiple tables The second may be relevant for you. If you always display and edit the phone numbers of a

Re: Arrays vs separate tables

2025-10-20 Thread Peter J. Holzer
On 2025-10-19 13:43:09 -0700, Rich Shepard wrote: > Now I'm slowly cleaning up my business tracking database using features not > available way back when I developed it. That's why I ask questions that must > seem obvious to all of you who work with postgres everyday and have for > years. I'm readi

Re: Arrays vs separate tables

2025-10-19 Thread Rich Shepard
On Sun, 19 Oct 2025, Ray O'Donnell wrote: 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 rea

Re: Arrays vs separate tables

2025-10-19 Thread Rich Shepard
On Sun, 19 Oct 2025, Adrian Klaver wrote: 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? Adrian, At this point I don't know. If there's no answer on one number I try another.

Re: Arrays vs separate tables

2025-10-19 Thread Ray O'Donnell
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) ha

Re: Arrays vs separate tables

2025-10-19 Thread Adrian Klaver
e'd be any performance benefit for making the change. I'm curious to learn about arrays vs separate tables. TIA, Rich -- Adrian Klaver [email protected]

Arrays vs separate tables

2025-10-19 Thread Rich Shepard
y performance benefit for making the change. I'm curious to learn about arrays vs separate tables. TIA, Rich