[eluser]danmontgomery[/eluser]
[quote author="Michael Wales" date="1265403654"]If you have these two columns indexed as unique you can just perform the insert. MySQL will see they already exist and continue on with its day.
Doesn't require the additional select query noctrum suggested and uses less resources than INSERT ... ON DUPLICATE KEY UPDATE.[/quote]
True, but only viable if a_id and b_id have a 1:1 relationship, and there is only one entry for each