Craig Ringer wrote:
yesРоман Маширов wrote: as dumb as possible :)Can you post the queries? worker parses several thousand events and do update queue set state=$1 where queue_id in (<id list>) and state in (<previous state list>) for each target state, so it performs 1-4 update queries. stat do delete from queue where queue_stamp < now()-'1day'::interval or state in (<terminal state list>) returning * The main reason for such thing is to reduce amount of queries to perform, since this queue could work at about 50 objects per second with 4 state changes. Yep, thank you very much!One option is to SELECT ... FOR UPDATE NOWAIT before your UPDATE or DELETE. But, it would be good feature to somehow allow to explicitly set order of multi-row update / delete, or to 'delete but locked', meaning delete all rows by given query parameters, except locked ones. -- MRJ |
- [GENERAL] Avoiding deadlocks on mass delete / up... Роман Маширов
- Re: [GENERAL] Avoiding deadlocks on mass de... Craig Ringer
- Re: [GENERAL] Avoiding deadlocks on mas... Роман Маширов
