From: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Modeling Friendship Relationships |
Date: | 2014-11-12 01:32:13 |
Message-ID: | 1415755933576-5826608.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2014-11-12 01:37:36 | Re: Modeling Friendship Relationships |
Previous Message | John R Pierce | 2014-11-12 01:20:37 | Re: Modeling Friendship Relationships |