Posted it in http://stackoverflow.com/q/22606063/1879564?sem=2
My guess is that postgres has an issue with locking referenced table.-- Amir Baron