Laurenz Albe doesn’t have MySQL envy:
If you are reading this hoping that PostgreSQL finally got
UPDATE ... LIMIT
like MySQL, I have to disappoint you. TheLIMIT
clause is not yet supported for DML statements in PostgreSQL. If you want toUPDATE
only a limited number of rows, you have to use workarounds. This article will describe how to do this and how to avoid the pitfalls and race condition you may encounter. Note that most of the following also applies toDELETE ... LIMIT
!
Click through for what you can do in PostgreSQL instead. In T-SQL, we can use UPDATE TOP(n).