[R] Fast update of a lot of records in a database?

Duncan Murdoch murdoch at stats.uwo.ca
Fri May 19 17:17:00 CEST 2006


We have a PostgreSQL table with about 400000 records in it.  Using 
either RODBC or RdbiPgSQL, what is the fastest way to update one (or a 
few) column(s) in a large collection of records?  Currently we're 
sending sql like

BEGIN
UPDATE table SET col1=value WHERE id=id
(repeated thousands of times for different ids)
COMMIT

and this takes hours to complete.  Surely there must be a quicker way?

Duncan Murdoch



More information about the R-help mailing list