I have a many-to-many relation, implemented with an association table in MySQL. I have a table for children and a table for parents. A child can have multiple parents, saved in the parent\_child\_link association table with their ID's. 

Children can be updated through a HTML form, the parents are in a HTML multi-select. Now I need to update the record in the database, but my solution is not very efficient. Here's in pseudocode what I do:

1. Update the child information where child\_id=x
2. Delete all the current associations in parent\_child\_link where child\_id=x
3. Insert the new associations

This solution works great, but when the the parents weren't changed, e.g. only the name of the child was changed, then there are 2 unnecessary queries executed. How can I avoid those unnecessary queries? Is there some way to check if the parents in the multi-select didn't change?

Ofcourse I could just ignore all this hassle, because it already works, but I really like to keep things as efficient as possible.