From: Steinar H. Gunderson Date: Sun, 30 Jul 2006 13:52:33 +0000 (+0200) Subject: When inserting multiple images at the same time, we could deadlock -- inserting X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=d1b49fa6c2fd1b3d449dc938f0731c0426636c02;hp=d1b49fa6c2fd1b3d449dc938f0731c0426636c02 When inserting multiple images at the same time, we could deadlock -- inserting new rows into images would (due to the foreign key constraint) lock the corresponding row in event using a shared lock, then the update (due to last_picture) would upgrade the lock to exclusive, causing a deadlock later. To fix this, we move last_picture into its own table; we could also lock it explicitly earlier, but that would stall other transactions (and they can run for 10-15 seconds or so, or perhaps even longer) so it is not desirable. ---