Re: question on most efficient way to increment a column
От | Tyson Maly |
---|---|
Тема | Re: question on most efficient way to increment a column |
Дата | |
Msg-id | 1368040479.39722.androidMobile@web120505.mail.ne1.yahoo.com обсуждение исходный текст |
Ответ на | question on most efficient way to increment a column (Tyson Maly <tvmaly@yahoo.com>) |
Ответы |
Re: question on most efficient way to increment a column
|
Список | pgsql-general |
The simple update is one I considered, but I think if I put it into a stored procedure it should run faster |
From: Albe Laurenz <laurenz.albe@wien.gv.at>;
To: Tyson Maly <tvmaly@yahoo.com>; pgsql-general@postgresql.org <pgsql-general@postgresql.org>;
Subject: Re: [GENERAL] question on most efficient way to increment a column
Sent: Wed, May 8, 2013 2:02:58 PM
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 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general |
В списке pgsql-general по дате отправления: