How can I improve performance of update query in PostgreSQL
In general mass-updates like this can take a long time, independent of the RDBMS used. 

Often a lot of time can be saved by running the update in batches of a few thousand rows at a time. Something like:

UPDATE schema.table set ...
 WHERE id &gt;=0 and id &lt; 10000

UPDATE schema.table set ...
 WHERE id &gt;=10000 and id &lt; 20000

...


Instead of manually typing the different update statements you certainly can use a loop too. Just make sure that there is no overarching transaction, as that would negate the effort.