Efficient way to update all rows in a table
Posted
by m_pGladiator
on Stack Overflow
See other posts from Stack Overflow
or by m_pGladiator
Published on 2010-04-14T07:45:33Z
Indexed on
2010/04/14
7:53 UTC
Read the original article
Hit count: 151
sql
Hi,
I have a table with a lot of records (could be more than 500 000 or 1 000 000). I added a new column in this table and I need to fill a value for every row in the column, using the corresponding row value of another column in this table.
I tried to use separate transactions for selecting every next chunk of 100 records and update the value for them, but still this takes hours to update all records in Oracle10 for example.
What is the most efficient way to do this in SQL, without using some dialect-specific features, so it works everywhere (Oracle, MSSQL, MySQL, PostGre etc.)?
© Stack Overflow or respective owner