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

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

Redirected to -hackers

Neil Conway kirjutas L, 15.11.2003 kell 22:20:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> > (I believe the previous discussion also agreed that we wanted to
> > postpone the freezing of now(), which currently also happens at
> > BEGIN rather than the first command after BEGIN.)
>
> That doesn't make sense to me: from a user's perspective, the "start
> of the transaction" is when the BEGIN is issued, regardless of any
> tricks we may play in the backend.

For me, the "start of transaction" is not about time, but about grouping
a set of statements into one. So making the exact moment of "start" be
the first statement that actually does something with data seems
perfectly reasonable. If you really need to preserve time, do "select
current_timestamp" and use the result.

> Making now() return the time the current transaction started is
> reasonably logical; making now() return "the time when the first
> command after the BEGIN in the current transaction was issued" makes a
> lot less sense to me.

for me "the time the current transactuion is started" == "the time when
the first command after the BEGIN in the current transaction was issued"
and thus I see no conflict here ;)

Delaying the locking effects of transactions as long as possible can
increase performance overall, not just for pathological clients that sit
on idle open transactions.

Probably the latest time we can start the transaction is ath the start
of executor step after the first statement in a transaction is planned
and optimized.

---------------
Hannu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2003-11-16 14:10:00 Re: ALTER TABLE modifications
Previous Message Jean-Michel POURE 2003-11-16 11:03:02 Defaut database encoding

Browse pgsql-performance by date

  From Date Subject
Next Message Nick Fankhauser 2003-11-16 13:52:29 Re: n_distinct way off, but following a pattern.
Previous Message Neil Conway 2003-11-15 20:20:43 Re: Help with count(*)