Re: question on most efficient way to increment a column

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: question on most efficient way to increment a column
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B05818F07@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на question on most efficient way to increment a column  (Tyson Maly <tvmaly@yahoo.com>)
Список pgsql-general
Tyson Maly wrote:
> If I have a simple table with an id as a primary key that is a serial column and a column to keep
> track of a total_count for a particular id, what method would provide the fastest way to increment the
> total_count in the shortest amount of time and minimize any locking?
>
> id  serial
> total_count integer

UPDATE tablename SET total_count=total_count+1 WHERE id=42;

Yours,
Laurenz Albe


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: question on most efficient way to increment a column
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Does it make sense to break a large query into separate functions?