start of transaction (was: Re: [PERFORM] Help with count(*))

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Will LaShell <will(at)lashell(dot)net>, Hannu Krosing <hannu(at)tm(dot)ee>, Christopher Browne <cbbrowne(at)acm(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: start of transaction (was: Re: [PERFORM] Help with count(*))
Date: 2003-11-16 23:18:02
Message-ID: 87n0avaonp.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> That's defensible when the user issued the BEGIN himself. When the
> BEGIN is coming from some interface library's autocommit logic, it's
> a lot less defensible. If you consult the archives, you will find
> actual user complaints about "why is now() returning a very old time?"
> that we traced to use of interface layers that handle "commit()" by
> issuing "COMMIT; BEGIN;".

Hmmm... I agree this behavior isn't ideal, although I can see the case
for viewing this as a mistake by the application developer: they are
assuming that they know exactly when transactions begin, which is not
a feature provided by their language interface. They should be using
current_timestamp, and/or changing their language interface's
configuration.

That said, I think this is a minor irritation at best. The dual
drawbacks of breaking backward compatibility and making the BEGIN
semantics more confusing is enough to leave me satisfies with the
status quo.

If we do change this, I think Dennis' idea of making now() always
return the same value within a given transaction is interesting: that
might be a way to fix this problem without confusing the semantics of
BEGIN.

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-11-17 00:08:24 Re: start of transaction (was: Re: [PERFORM] Help with count(*))
Previous Message Neil Conway 2003-11-16 22:55:41 Re: start of transaction (was: Re: [PERFORM] Help with count(*))

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-11-17 00:08:24 Re: start of transaction (was: Re: [PERFORM] Help with count(*))
Previous Message Neil Conway 2003-11-16 22:55:41 Re: start of transaction (was: Re: [PERFORM] Help with count(*))