I am running PostgreSQL 13, and single UPDATE statement that seems like it would be trivial to complete can take hours (at least in one case more than 24 hours).
Selecting the rows with a SELECT statement takes under a second. Updating the rows is drastically slower, within only 30000 rows affected.
The column in question that I am trying to update is not indexed. The database is also well-provisioned for the scale of the database. While the query is active, I can see 1 of the 4 vCPU at full throttle. Memory settings are tuned to typical defaults recommended for a 32GB RAM system.
After the first execution, I can flip the boolean archived column back & forth much more quickly (5 minutes first UPDATE -> 15 seconds to do inverse in my simulated case).
There are some properties that make this table unique. The schema of the DB is highly normalized. This table holds the names and uuids for many of the data models, so there are many FK relationships. The table has 16 columns, with 10 indexes and 4 constraints. The updated column value is not part of a constraint or an index.
Why is performance for this update query so poor? Is there anything I can do to improve the performance?