Re: Transactions within Function - Mailing list pgsql-novice

From Andy Chambers
Subject Re: Transactions within Function
Date
Msg-id CAAfW55q-W74ibvRbrtOxp3rONq5qK1ieZzTo0-W2iQPG-Vg69g@mail.gmail.com
Whole thread Raw
In response to Transactions within Function  (Steve Horn <steve@stevehorn.cc>)
Responses Re: Transactions within Function  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-novice
On Wed, Apr 4, 2012 at 12:07 PM, Steve Horn <steve@stevehorn.cc> wrote:
> I have a very basic function that performs several steps. Each one of these
> steps could take a significant amount of time which I would like to track.
>
> To do this I am inserting a record to a logging table with a timestamp.
> After my function runs, all of my log entries have the exact same timestamp.
> I am assuming this is because they are all being committed in the same
> transaction.
>
> Is there a way I can commit those log inserts in real time?

Use timeofday() rather than current_time.

http://www.postgresql.org/docs/9.1/static/functions-datetime.html

--
Andy Chambers
Software Engineer
(e) achambers@mcna.net

pgsql-novice by date:

Previous
From: Steve Horn
Date:
Subject: Transactions within Function
Next
From: Merlin Moncure
Date:
Subject: Re: Transactions within Function