Search Postgresql Archives

Re: deadlock between "WITH agg_tmp AS ({sel_stmt}), upd AS ({upd_stmt}) {ins_stmt}" and pure UPDATE statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've already switched to 'UPSERT', it didn't resolved deadlock issue by itself... Added LOCK TABLE ... IN EXCLUSIVE MODE; to one session, hope it will help.

You did not mention what version of Postgres you are using, if it is
9.5+ you have the 'UPSERT' option available instead of using the WITH
construct:


https://www.postgresql.org/docs/9.5/static/sql-insert.html

ON CONFLICT Clause

https://www.depesz.com/2015/05/10/waiting-for-9-5-add-support-for-insert-on-conflict-do-nothingupdate/


If not you might to take a look at:

http://stackoverflow.com/questions/17267417/how-to-upsert-merge-insert-on-duplicate-update-in-postgres


Bulk upsert with lock




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux