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

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sat 20 May 2006 - 01:17:00 EST

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

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

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 20 01:31:30 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 20 May 2006 - 04:10:11 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.