Re: question on most efficient way to increment a column

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tyson Maly <tvmaly(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: question on most efficient way to increment a column
Date: 2013-05-08 14:02:34
Message-ID: CAHyXU0zK1KFE=XOOtnihrtE9BsAqfx6Ai0XGpLKVQUZe6QtNzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 8, 2013 at 8:45 AM, Tyson Maly <tvmaly(at)yahoo(dot)com> 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
>

uh,
update foo set total_count = total_count + 1 where id = x;
?

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-05-08 14:02:58 Re: question on most efficient way to increment a column
Previous Message Tyson Maly 2013-05-08 13:45:13 question on most efficient way to increment a column