Re: How long does commit take?

From: "Daniel T(dot) Staal" <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: How long does commit take?
Date: 2007-04-26 15:16:43
Message-ID: 51401.63.172.115.138.1177600603.squirrel@MageHandbook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Thu, April 26, 2007 10:52 am, Tom Lane said:
> Reinhard Hnat <hnat(at)logotronic(dot)co(dot)at> writes:
>> I would like to know how long it will take until the effects of a
>> transaction is visible from outside after a commit statement.
>
> There is no delay.

You are telling me the database is always able to update all it's internal
records instantaneously? I doubt that. I'm sure there is a delay, the
length of which is dependent on the machine, table layout, other load on
the machine, etc. (Basically, the commit will take a measurable amount of
time to execute.) I'd expect it to be a few milliseconds in most cases,
but no more.

If you are running in to this, you probably should write in a sleep call
for a quarter of a second or so. (Well more than I would expect the commit
to take on most machines.) If that amount of time is unworkable, than you
either need to have a custom solution of some sort built for your needs
(you are beyond what a database is designed to be able to handle) or you
should re-write your code so that the query is part of the same
transaction.

If the problem is that everything must always process in a certain order,
despite being from multiple workstations, I suggest you look into the
different locking modes available. You can prevent access to that data
until the commit is completed.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2007-04-26 18:22:24 Fwd: Re: pg_dump
Previous Message Tom Lane 2007-04-26 14:52:07 Re: How long does commit take?