Didn't we just determine a couple of days ago that triggers were performance killers?
That's one reason I want to avoid those. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________________ From: [email protected] [[email protected]] on behalf of Jim Morris [[email protected]] Sent: Wednesday, February 09, 2011 12:42 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Bi-directional unique If you don't care about the order then use and instead of trigger to force the ordering then you will get the collisions you expect. On 2/9/2011 10:12 AM, 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. > > > > create table t(i int, j int); > > insert into t(1,2); > > insert into t(2,1);<< should give an error because the pairing of 1-2 > already exists. > > insert into t(3,2);<< OK > > insert into t(3,1);<< OK > > insert into t(1,3);<< should be error > > > > You can't guarantee that one column is less than the other so there's no win > there. > > > > 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? > > > > > > Michael D. Black > > Senior Scientist > > NG Information Systems > > Advanced Analytics Directorate > > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

