Black, Michael (IS) wrote:
> I have a need to create a unique bi-directional relationship.
> 
> You can think of it as pairings of people who eat dinner together.
> 
> You can't guarantee that one column is less than the other so there's no win 
> there.

Why can't you have a well-known ordering for your values?  It doesn't have to 
be 
meaningful, and it should be very easy.  Do a sort on the binary 
representations 
if you don't have a better one.  As long as you have that, put the value that 
orders first or equal in the same column all the time.  Then have a unique key 
constraint over the pair of columns.  Problem solved.

> Speed is of the utmost concern here so fast is really important (how many 
> ways can I say that???).
> 
> Is there anything clever here that can be done with indexes or such?

Just what I said will do what you want and it is the simplest solution plus 
most 
efficient in both performance and disk usage.

-- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to