Hi,
Its a kind of error which happen there is issues with DB connections, PHP script taking too long to execute or response is very large (which is probable in case of Magento)
==========
you can make the following changes to my.cnf settings:
max_allowed_packet = 16M
wait_timeout = 1800
connect_timeout = 120
Then need to restart your MySQL server.
===========
If the above solution doesnot work try to run your raw sql query and test if its actually working properly.