Re: One tuple per transaction

From: "Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)ee>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: One tuple per transaction
Date: 2005-03-13 17:21:26
Message-ID: A66A11DBF5525341AEF6B8DE39CDE770088050@black.aprote.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> -----Original Message-----
> From: Josh Berkus [mailto:josh(at)agliodbs(dot)com]
> Sent: Sunday, March 13, 2005 12:05 AM
> To: Tambet Matiisen
> Cc: pgsql-performance(at)postgresql(dot)org
> Subject: Re: [PERFORM] One tuple per transaction
>
>
> Tambet,
>
> > In one of our applications we have a database function, which
> > recalculates COGS (cost of good sold) for certain period. This
> > involves deleting bunch of rows from one table, inserting
> them again
> > in correct order and updating them one-by-one (sometimes one row
> > twice) to reflect current state. The problem is, that this
> generates
> > an enormous amount of tuples in that table.
>
> Sounds like you have an application design problem ... how
> about re-writing
> your function so it's a little more sensible?
>

I agree, that I have violated the no 1 rule of transactions - don't make
the transaction last too long. But imagine a situation, where a table is
updated twice in transaction. Why? Perhaps programmer felt, that the
code is more modular in this way. Now if you have tons of those
transactions, the I/O throughput is twice as big as it could be, because
every transaction creates two tuples instead of one. One tuple per
transaction could allow the programmer to keep his modular code and
benefit from the increased performance.

Tambet

Browse pgsql-performance by date

  From Date Subject
Next Message Miroslav Šulc 2005-03-13 17:23:51 Re: How to read query plan
Previous Message Miroslav Šulc 2005-03-13 17:10:31 Re: How to read query plan