Re: [GENERAL] Enforce Symmetric Matrix

2014-05-09 Thread Randy Westlund
On Wed, May 07, 2014 at 04:07:22PM -0500, John McKown wrote: > On Wed, May 7, 2014 at 3:36 PM, Randy Westlund wrote: > > > I have a table with N (over 35k) rows. I need to compare each of > > those elements to every other element in the list, which is the > > handshake problem. > > > > This resu

Re: [GENERAL] Enforce Symmetric Matrix

2014-05-07 Thread David G Johnston
SELECT l.id, u.id, func(l.id, u.id) FROM ids l CROSS JOIN ids u WHERE l.id < u.id Depending on whether you always update a known pair, or instead invalidate all rows where either id is a given value, you can use various means to manage the resultant materialized view. Triggers or interface functi

[GENERAL] Enforce Symmetric Matrix

2014-05-07 Thread Randy Westlund
I have a table with N (over 35k) rows. I need to compare each of those elements to every other element in the list, which is the handshake problem. This results in a symmetric matrix (an adjacency matrix for an undirected graph). Because all relations are symmetric, I only need to store the uppe