Re: Is there a batch/bulk UPDATE syntax available?

Поиск
Список
Период
Сортировка
От Keith Gabryelski
Тема Re: Is there a batch/bulk UPDATE syntax available?
Дата
Msg-id AANLkTi=Xy9Q7BXTy19EDbsG3YWEL46mS-FJ6VFLH+xfu@mail.gmail.com
обсуждение исходный текст
Ответ на Is there a batch/bulk UPDATE syntax available?  ("Gnanakumar" <gnanam@zoniac.com>)
Список pgsql-admin
create table tmp
(
  id serial not null primary key,
  name text,
  age integer
);

insert into tmp (name,age) values ('keith', 43),('leslie', 40),('bexley', 19),('casey', 6);

update tmp
 set age = data_table.age
from
(
  select 'keith'::text as name, 44::integer as age
 union
  select 'leslie', 50
 union
  select 'bexley', 10
 union
  select 'casey', 12
) as data_table
where
 tmp.name = data_table.name;


On Thu, Feb 3, 2011 at 7:00 AM, Gnanakumar <gnanam@zoniac.com> wrote:
> Hi,
>
> Is there a batch/bulk UPDATE query syntax available in PostgreSQL, similar
> to multirow VALUES syntax available for INSERT?
>
> INSERT Multirow VALUES syntax example:
> INSERT INTO films (code, title, did, date_prod, kind) VALUES
>    ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'),
>    ('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');
>
> There is a situation in my application, where I am performing lots and lots
> of updates on individual rows. I am trying to figure out how to make the
> updates faster.
>
> Any other ideas/ways to make updates faster are highly appreciated.
>
> Regards,
> Gnanam
>
>

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

Предыдущее
От: Fabricio
Дата:
Сообщение: mapping libraries
Следующее
От: Selva manickaraja
Дата:
Сообщение: Cascading Recovery