Need Oracle 9 tester. was Re: current_timestamp after queries - Mailing list pgsql-general

From Bruce Momjian
Subject Need Oracle 9 tester. was Re: current_timestamp after queries
Date
Msg-id 200209301534.g8UFYvF19042@candle.pha.pa.us
Whole thread Raw
In response to Re: current_timestamp after queries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, timeofday() will work, but it can change during the statement, right?
>
> For what he was doing, it seemed perfectly acceptable.
>
> This comes back to the point I've been making during the pghackers
> discussion: start-of-transaction time has clear uses, and
> exact-current-time has clear uses, but it's not nearly as obvious
> why you'd need start-of-statement time in preference to either of
> the others.

How about:

    BEGIN;
    LOCK tab;  -- could block
    INSERT INTO tab VALUES (..., CURRENT_TIMESTAMP);

If this is an order-entry application, you would want the statement
start time, not the transaction start time.  However, if you were
inserting this into several tables, we would want transaction timestamp
so it is always the same.

Is someone running Oracle 9 that can test this?  We need:

    BEGIN;
    SELECT CURRENT_TIMESTAMP;
    -- wait 5 seconds
    SELECT CURRENT_TIMESTAMP;

Are those two timestamps the same?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: current_timestamp after queries
Next
From: "Andy Kriger"
Date:
Subject: how do i find out how long a query took?