Received: from smtp012.mail.yahoo.com (smtp012.mail.yahoo.com [216.136.173.32]) by postgresql.org (8.11.3/8.11.4) with SMTP id f9IGgLP85824 for ; Thu, 18 Oct 2001 12:42:21 -0400 (EDT) (envelope-from brett_schwarz@yahoo.com) Received: from c1377995-a.bllvu1.wa.home.com (HELO thor) (65.4.166.93) by smtp.mail.vip.sc5.yahoo.com with SMTP; 18 Oct 2001 16:42:19 -0000 X-Apparently-From: Date: Thu, 18 Oct 2001 09:31:49 -0700 From: Brett Schwarz To: Mr OCP Cc: pgsql-admin@postgresql.org Subject: Re: Please help - tks Message-Id: <20011018093149.3e1245af.brett_schwarz@yahoo.com> In-Reply-To: <20011018063501.31635.qmail@web20610.mail.yahoo.com> References: <20011018063501.31635.qmail@web20610.mail.yahoo.com> X-Mailer: Sylpheed version 0.6.2 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200110/175 X-Sequence-Number: 2419 A quick and dirty solution would be something like (untested): while read line; do psql dbname -c "update table ... use 'line' as your id and data" sleep 5 done < filename where "filename" is the file with the ids in it. "dbname" is the name of your DB (of course!) I am not sure what your file looks like, but you can do something like this. It could be easy, or harder, depending on what your file has. adjust the sleep to your own specs. --brett P.S. You could test this out by doing: while read line; do psql dbname -c "select * from table where id=$line" sleep 5 done < filename On Thu, 18 Oct 2001 16:35:01 +1000 (EST) Mr OCP wrote: > Hi Folks > > We have about 300,000 records to update, I have > created a file with the ids of the records to be > updated, since the number of records to be updated is > very large, the update statement takes forever and > server slows down dramatically, therefore I want to do > one at a time. > > Do you guys have any script which may update records > one by one using the file that lists these records. I > am running postgresql sever under Unix, any kind of > script would do, whether its a perl, bash or sql > whatever script > > Thanks for your help > Mike > > http://briefcase.yahoo.com.au - Yahoo! Briefcase > - Manage your files online. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com