Re: Modeling Friendship Relationships - Mailing list pgsql-general

From David G Johnston
Subject Re: Modeling Friendship Relationships
Date
Msg-id 1415755933576-5826608.post@n5.nabble.com
Whole thread Raw
In response to Re: Modeling Friendship Relationships  (John R Pierce <pierce@hogranch.com>)
Responses Re: Modeling Friendship Relationships
List pgsql-general
John R Pierce wrote
> a difficulty of the single entry for joe<->bob  is that its hard to have
> a unique constraint across two fields.     you'd want to ensure that
> joe+bob is unique and that there's no bob+joe

Bill's solution:

 PRIMARY KEY (person1, person2),
 CHECK (person1 < person2)

seems to make this constraint fairly simple...am I missing something?

Usage need permitting how difficult would setting up materialized views to
maintain arrays of "friend_of" and "friends_are" and simply unnest those
arrays if record-oriented access to the contained ids is required?  More
basically how performant (generally) are ~200 element arrays?

David J.




--
View this message in context: http://postgresql.nabble.com/Modeling-Friendship-Relationships-tp5826592p5826608.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Modeling Friendship Relationships
Next
From: John R Pierce
Date:
Subject: Re: Modeling Friendship Relationships