On Fri, 2014-12-05 at 10:00 -0800, Josh Berkus wrote: > I thought the point of INSERT ... ON CONFLICT update was so that you > didn't have to care if it was a new row or not? > > If you do care, it seems like it makes more sense to do your own INSERTs > and UPDATEs, as Django currently does.
Django tries to update the object if it already exists in the database. If it doesn't, then Django does an insert. This is suboptimal from concurrency standpoint, and does two round trips to the database instead of just one. For Django, both insert and update are OK when saving an object to the database, but Django needs to know which one was done. I too agree that this doesn't need to be handled in the first version of the patch. - Anssi -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers