Updating multiple records sql

The dominant factor in the time taken to complete the overall operation tends to be the “admin” work in conveying the application’s intention to the database server rather than the actual updates to the database.

updating multiple records sql-4updating multiple records sql-62updating multiple records sql-82

But we can group the updates according to the value being set, and then do one UPDATE statement per distinct value.

But in many cases this only provides a modest improvement as each UPDATE operation still requires a round-trip communication with the database server.

In the case where the application server and database server are on different hosts, the round-trip will involve network latency as well.

Is there a cleaner way to roll this up into one statement rather than two.

I've tried several iterations but this seems to be the only way I can successfully execute these two statements.

Leave a Reply