Re: How long does commit take? - Mailing list pgsql-novice

From Daniel T. Staal
Subject Re: How long does commit take?
Date
Msg-id 51401.63.172.115.138.1177600603.squirrel@MageHandbook.com
Whole thread Raw
In response to Re: How long does commit take?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: How long does commit take?  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
List pgsql-novice
On Thu, April 26, 2007 10:52 am, Tom Lane said:
> Reinhard Hnat <hnat@logotronic.co.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.
---------------------------------------------------------------


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: How long does commit take?
Next
From: "Andrej Ricnik-Bay"
Date:
Subject: Fwd: Re: pg_dump