I'm bulk updating some rows using UPDATE ... FROM (values ... as described in this answer.
Will the rows will be locked in the order that they appear in the values? Or do I need to do an explicit SELECT FOR UPDATE first?
Here's an example statement
UPDATE stats as t set "individualCount" = new_values."individualCount"
FROM (values (6::int,7::int),(3::int,15::int))
as new_values("individualCount","id")
WHERE new_values."id" = t."id"
(id is the primary key of the table)
NOWAITdoes not seem to be in the documentation? https://www.postgresql.org/docs/current/sql-select.html Based on the docs it seems purely for avoiding waiting, it doesn't mention that it will impact ordering and deadlock avoidance – ChrisJ Feb 04 '23 at 02:38