Re: question on most efficient way to increment a column

From: Scott Marlowe <scott(dot)marlowe(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-09 02:10:12
Message-ID: CAOR=d=3=p++p9u7B+s23U64hA-5x19uy=YeD+7HDQJL9rJdG3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How often are these updated? Once an hour, once a minute, once a
second, a thousand times a second?

If it's not more than once a second I would look at eager materialized
views as a possibility for handing this.

http://tech.jonathangardner.net/wiki/PostgreSQL/Materialized_Views#Eager_Materialized_View

On Wed, May 8, 2013 at 7: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
>
> Best regards,
>
> Ty
>

--
To understand recursion, one must first understand recursion.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Grittner 2013-05-09 02:31:20 Re: Normal errors codes in serializable transactions
Previous Message Bruce Momjian 2013-05-09 00:52:40 Re: pg_upgrade -u