Re: [GENERAL] question on most efficient way to increment a column

2013-05-09 Thread Tyson Maly
In some cases, it would be 2-10 times a second per id. From: Scott Marlowe To: Tyson Maly Cc: "pgsql-general@postgresql.org" Sent: Wednesday, May 8, 2013 10:10 PM Subject: Re: [GENERAL] question on most efficient way to increment a column How

Re: [GENERAL] question on most efficient way to increment a column

2013-05-08 Thread Scott Marlowe
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

Re: [GENERAL] question on most efficient way to increment a column

2013-05-08 Thread Alban Hertroys
On May 8, 2013, at 21:14, Tyson Maly wrote: > > The simple update is one I considered, but I think if I put it into a stored > procedure it should run faster > Well, you would partially circumvent the query planner, but you would also circumvent any optimisation said query planner would be

Re: [GENERAL] question on most efficient way to increment a column

2013-05-08 Thread Albe Laurenz
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?

Re: [GENERAL] question on most efficient way to increment a column

2013-05-08 Thread Merlin Moncure
On Wed, May 8, 2013 at 8:45 AM, 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 t