Re: very slow updates

Поиск
Список
Период
Сортировка
От g.hintermayer@inode.at (Gerhard Hintermayer)
Тема Re: very slow updates
Дата
Msg-id bd4db85f.0208010439.1b4f7cd6@posting.google.com
обсуждение исходный текст
Ответ на very slow updates  (Xavier Bugaud <xavier.bugaud@parabolemaurice.com>)
Список pgsql-general
xavier.bugaud@parabolemaurice.com (Xavier Bugaud) wrote in message
news:<A4AAC8CD87A2D511B796004005420B1F64CED3@PMSERVER>...
> Hi,
>
> I'm running PostgreSQL 7.2.1 with a redhat 7.2 box (PIII 800 / 256MB RAM /
> RAID1 IDE : promise TX2000).
> I'm new to Postgres, so perhaps I missed something...
>
> Here is the point :
> Using JDBC, I update one column for all the 1600 rows of a table (10
> columns) : I'm running 1600 times a query like this :
> for (i=0 ; i<1600 ; i++)
>   rs2.executeUpdate("UPDATE my_table SET my_date=now() WHERE id="+i);
>

Why 1600 updates, when you could do it in one ? Either use no where
clause (if you're really want to update all rows) or use "id>=0 AND
id<1600" as where clause.

Gerhard

В списке pgsql-general по дате отправления:

Предыдущее
От: Holger Klawitter
Дата:
Сообщение: Re: Regular expressions or LIKE ? HELP needed !
Следующее
От: Fabiàn R.Breschi
Дата:
Сообщение: Re: MySQL or Postgres ?