Faster way to update 250k rows with SQL
Posted
by pablo
on Stack Overflow
See other posts from Stack Overflow
or by pablo
Published on 2010-04-23T00:36:11Z
Indexed on
2010/04/23
0:43 UTC
Read the original article
Hit count: 250
I need to update about 250k rows on a table and each field to update will have a different value depending on the row itself (not calculated based on the row id or the key but externally).
I tried with a parametrized query but it turns out to be slow (I still can try with a table-value parameter, SqlDbType.Structured, in SQL Server 2008, but I'd like to have a general way to do it on several databases including MySql, Oracle and Firebird).
Making a huge concat of individual updates is also slow.
What about creating a temp table and running an update joining my table and the tmp one? Will it work faster?
© Stack Overflow or respective owner