It has been years since I've had to do anything more complicated with SQL than your basic SELECT query, so I can't quite recall the best way to do this. We are using PostgreSQL and Java.
I have a HashMap with a bunch of (id, value) pairs. Conveniently, I also have a table with the columns "id" and "value". I need a way to update all those columns in the table with the values from the HashMap. However, this will potentially involve changing millions of rows, so running a million separate UPDATE statements seems like a bad idea. Is there an efficient way to do a single, huge UPDATE statement that will set all the (id, value) pairs properly?
I have a HashMap with a bunch of (id, value) pairs. Conveniently, I also have a table with the columns "id" and "value". I need a way to update all those columns in the table with the values from the HashMap. However, this will potentially involve changing millions of rows, so running a million separate UPDATE statements seems like a bad idea. Is there an efficient way to do a single, huge UPDATE statement that will set all the (id, value) pairs properly?
