I have a requirement to update a text column for all rows of a RDBMS table (PostgresSQL) with a fixed text. Currently, table has around 700k records but that is expected to grow. SpringJDBC batch update is slow with following query,
UPDATE TABLE TABLENAME SET columnname="FIXED VALUE"
This columns is NULLABLE. Is it advisable to replace this single UPDATE statement with these two steps?
1. First drop this column from table
2.Readd the column to table specifying default value to be "FIXED VALUE"
I tested code and its very faster than UPDATE statement.
I just wanted to ask you folks if there is any negative side to the approach of dropping and adding column again?
I am running these SQLs in Java via SpringJDBC