pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
start of transaction (was: Re: [PERFORM] Help with count(*))
13+ messages / 7 participants
[nested] [flat]

* start of transaction (was: Re: [PERFORM] Help with count(*))
@ 2003-11-16 11:58 ` Hannu Krosing <hannu@tm.ee>
  2003-11-16 14:50   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-16 22:55   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  1 sibling, 2 replies; 13+ messages in thread

From: Hannu Krosing @ 2003-11-16 11:58 UTC (permalink / raw)
  To: Neil Conway <neilc@samurai.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Redirected to -hackers

Neil Conway kirjutas L, 15.11.2003 kell 22:20:
> Tom Lane <tgl@sss.pgh.pa.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





^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 11:58 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Hannu Krosing <hannu@tm.ee>
@ 2003-11-16 14:50   ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-16 15:51     ` Re: start of transaction (was: Re: [PERFORM] Help with Dennis Bjorklund <db@zigo.dhs.org>
  1 sibling, 1 reply; 13+ messages in thread

From: Tom Lane @ 2003-11-16 14:50 UTC (permalink / raw)
  To: Hannu Krosing <hannu@tm.ee>; +Cc: Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Hannu Krosing <hannu@tm.ee> writes:
> 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.

The transaction has to exist before it can take locks, so the above
would not fly.

A complete example of what we have to think about is:

	BEGIN;
	SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
	LOCK TABLE foo;
	UPDATE foo ...  -- or in general a SELECT/UPDATE/INSERT/DELETE query
	... etc ...

The transaction snapshot *must* be set at the time of the first query
(here, the UPDATE).  It obviously can't be later, and it cannot be
earlier either, because in this sort of example you need the requested
locks to be taken before the snapshot is set.

The transaction must be created (as observed by other backends, in
particular VACUUM) not later than the LOCK statement, else there is
nothing that can own the lock.  In principle though, the effects of
BEGIN and perhaps SET could be strictly local to the current backend,
and only when we hit a LOCK or query do we create the transaction
externally.

In practice the problem we observe is clients that issue BEGIN and then
go to sleep (typically because of poorly-designed autocommit behavior in
interface libraries).  Postponing externally-visible creation of the
transaction to the first command after BEGIN would be enough to get
around the real-world issues, and it would not require code changes
nearly as extensive as trying to let other stuff like SET happen
"before" the transaction starts.

There isn't any compelling implementation reason when to freeze the
value of now().  Reasonable options are
	1. at BEGIN (current behavior)
	2. at transaction's external creation 
	3. at freezing of transaction snapshot
#1 and #2 are actually the same at the moment, but could be decoupled
as sketched above, in which case the behavior of #2 would effectively
become "at first command afte BEGIN".

In the previous thread:
http://archives.postgresql.org/pgsql-hackers/2003-03/msg01178.php
I argued that now() should be frozen at the time of the transaction
snapshot, and I still think that that's a defensible behavior.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with
  2003-11-16 11:58 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Hannu Krosing <hannu@tm.ee>
  2003-11-16 14:50   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-11-16 15:51     ` Dennis Bjorklund <db@zigo.dhs.org>
  0 siblings, 0 replies; 13+ messages in thread

From: Dennis Bjorklund @ 2003-11-16 15:51 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Hannu Krosing <hannu@tm.ee>; Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Sun, 16 Nov 2003, Tom Lane wrote:

> There isn't any compelling implementation reason when to freeze the
> value of now().  Reasonable options are
> 	1. at BEGIN (current behavior)
> 	2. at transaction's external creation 
> 	3. at freezing of transaction snapshot
> #1 and #2 are actually the same at the moment, but could be decoupled
> as sketched above, in which case the behavior of #2 would effectively
> become "at first command afte BEGIN".
> 
> I argued that now() should be frozen at the time of the transaction
> snapshot, and I still think that that's a defensible behavior.

Is it important exactly what value is returned as long as it's the same in 
the whole transaction? I think not.

To me it would be just as logical to fix it at the first call to now() in
the transaction. The first time you call it you get the actual time as it
is now and the next time you get the same as before since every operation
in the transaction logically happens at the same time. If you don't call
now() at all, the system time will not be fetched at all.

-- 
/Dennis




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 11:58 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Hannu Krosing <hannu@tm.ee>
@ 2003-11-16 22:55   ` Neil Conway <neilc@samurai.com>
  2003-11-17 06:11     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Greg Stark <gsstark@mit.edu>
  1 sibling, 1 reply; 13+ messages in thread

From: Neil Conway @ 2003-11-16 22:55 UTC (permalink / raw)
  To: Hannu Krosing <hannu@tm.ee>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Hannu Krosing <hannu@tm.ee> writes:
> 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.

This might be a perfectly logical change in semantics, but what
benefit does it provide over the old way of doing things?

What does BEGIN actually do now, from a user's perspective? At
present, it "starts a transaction block", which is pretty simple. If
we adopted the proposed change, it would "change the state of the
system so that the next command is part of a new transaction". This is
naturally more complex; but more importantly, what benefit does it
ACTUALLY provide to the user?

(I can't see one, but perhaps I'm missing something...)

> 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.

I agree, but this is irrelevant to the semantics of now().

-Neil




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 11:58 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Hannu Krosing <hannu@tm.ee>
  2003-11-16 22:55   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
@ 2003-11-17 06:11     ` Greg Stark <gsstark@mit.edu>
  2003-11-17 07:09       ` Re: start of transaction (was: Re: [PERFORM] Help with Stephan Szabo <sszabo@megazone.bigpanda.com>
  0 siblings, 1 reply; 13+ messages in thread

From: Greg Stark @ 2003-11-17 06:11 UTC (permalink / raw)
  To: pgsql-hackers@postgresql.org


Neil Conway <neilc@samurai.com> writes:

> What does BEGIN actually do now, from a user's perspective? 

I think you're thinking about this all wrong. BEGIN doesn't "do" anything.
It's not a procedural statement, it's a declaration. It declares that the
block of statements form a transaction so reads should be consistent and
failures should be handled in a particular way to preserve data integrity.

Given that declaration and the guarantees it requires of the database it's
then up to the database to figure out what constraints that imposes on what
the database can do and still meet the guarantees the BEGIN declaration
requires. The more clever the database is about minimizing those restrictions
the better as it means the database can run more efficiently.

For what it's worth, this is how Oracle handles things too. On the
command-line issuing a BEGIN following a COMMIT is just noise; you're _always_
in a transaction. A COMMIT ends the previous the transaction and implicitly
starts the next transaction. But the snapshot isn't frozen until you first
read from a table.

I'm not sure what other databases do, but I think this is why clients behave
like this. They think of BEGIN as a declaration and therefore initiating a
COMMIT;BEGIN; at the end of every request is perfectly logical, and works fine
in at least Oracle, and probably other databases.

-- 
greg




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with
  2003-11-16 11:58 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Hannu Krosing <hannu@tm.ee>
  2003-11-16 22:55   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 06:11     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Greg Stark <gsstark@mit.edu>
@ 2003-11-17 07:09       ` Stephan Szabo <sszabo@megazone.bigpanda.com>
  0 siblings, 0 replies; 13+ messages in thread

From: Stephan Szabo @ 2003-11-17 07:09 UTC (permalink / raw)
  To: Greg Stark <gsstark@mit.edu>; +Cc: pgsql-hackers@postgresql.org

On Sun, 17 Nov 2003, Greg Stark wrote:

> Neil Conway <neilc@samurai.com> writes:
>
> > What does BEGIN actually do now, from a user's perspective?
>
> I think you're thinking about this all wrong. BEGIN doesn't "do" anything.
> It's not a procedural statement, it's a declaration. It declares that the
> block of statements form a transaction so reads should be consistent and
> failures should be handled in a particular way to preserve data integrity.
>
> Given that declaration and the guarantees it requires of the database it's
> then up to the database to figure out what constraints that imposes on what
> the database can do and still meet the guarantees the BEGIN declaration
> requires. The more clever the database is about minimizing those restrictions
> the better as it means the database can run more efficiently.
>
> For what it's worth, this is how Oracle handles things too. On the
> command-line issuing a BEGIN following a COMMIT is just noise; you're _always_
> in a transaction. A COMMIT ends the previous the transaction and implicitly
> starts the next transaction. But the snapshot isn't frozen until you first
> read from a table.

The earlier portion of the described behavior is AFAICS not complient to
SQL99 at least. COMMIT (without AND CHAIN) terminates a transaction and
does not begin a new one. The new transaction does not begin until a
transaction initiating command (for example START TRANSACTION, CREATE
TABLE, INSERT, ...) is executed. The set of things you can do that aren't
initiating is fairly small admittedly, but it's not a null set.



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* start of transaction (was: Re: [PERFORM] Help with count(*))
@ 2003-11-16 23:18 ` Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 13+ messages in thread

From: Neil Conway @ 2003-11-16 23:18 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Will LaShell <will@lashell.net>; Hannu Krosing <hannu@tm.ee>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org

Tom Lane <tgl@sss.pgh.pa.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




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
@ 2003-11-17 00:08   ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-17 00:31     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
  2003-11-17 10:16     ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>
  0 siblings, 2 replies; 13+ messages in thread

From: Tom Lane @ 2003-11-17 00:08 UTC (permalink / raw)
  To: Neil Conway <neilc@samurai.com>; +Cc: Will LaShell <will@lashell.net>; Hannu Krosing <hannu@tm.ee>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org

Neil Conway <neilc@samurai.com> writes:
> 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.

Well, actually, it's a bug in the interface IMHO.  But as I said in the
last thread, it's a fairly widespread bug.  We've been taking the
position that the interface libraries should get fixed, and that's not
happening.  It's probably time to look at a server-side fix.

> If we do change this, I think Dennis' idea of making now() always
> return the same value within a given transaction is interesting:

You mean the time of the first now() call?  I thought that was an
interesting idea also, but it's probably not going to look so hot
when we complete the TODO item of adding access to
the start-of-current-statement time.  Having start-of-transaction be
later than start-of-statement isn't gonna fly :-(.  If we were willing
to abandon that TODO item then I'd be interested in defining now() as
Dennis suggested.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-11-17 00:31     ` Bruce Momjian <pgman@candle.pha.pa.us>
  2003-11-17 10:19       ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>
  1 sibling, 1 reply; 13+ messages in thread

From: Bruce Momjian @ 2003-11-17 00:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Hannu Krosing <hannu@tm.ee>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org

Tom Lane wrote:
> Neil Conway <neilc@samurai.com> writes:
> > 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.
> 
> Well, actually, it's a bug in the interface IMHO.  But as I said in the
> last thread, it's a fairly widespread bug.  We've been taking the
> position that the interface libraries should get fixed, and that's not
> happening.  It's probably time to look at a server-side fix.
> 
> > If we do change this, I think Dennis' idea of making now() always
> > return the same value within a given transaction is interesting:
> 
> You mean the time of the first now() call?  I thought that was an
> interesting idea also, but it's probably not going to look so hot
> when we complete the TODO item of adding access to
> the start-of-current-statement time.  Having start-of-transaction be
> later than start-of-statement isn't gonna fly :-(.  If we were willing
> to abandon that TODO item then I'd be interested in defining now() as
> Dennis suggested.

Defining now() as the first call seems pretty arbitrary to me.  I can't
think of any time-based interface that has that API.  And what if a
trigger called now() in an earlier query and you didn't even know about
it.


-- 
  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



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-17 00:31     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
@ 2003-11-17 10:19       ` Hannu Krosing <hannu@tm.ee>
  2003-11-18 00:52         ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 13+ messages in thread

From: Hannu Krosing @ 2003-11-17 10:19 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Bruce Momjian kirjutas E, 17.11.2003 kell 02:31:

> Defining now() as the first call seems pretty arbitrary to me.  I can't
> think of any time-based interface that has that API.  And what if a
> trigger called now() in an earlier query and you didn't even know about
> it.

That would be OK. The whole point of that previous discussion was to
have now() that returns the same value over the span of the whole
transaction.

It would be even better to have now() that returns the time current
transaction is COMMITted as this is the time other backend become aware
of it ;)

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




^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-17 00:31     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
  2003-11-17 10:19       ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>
@ 2003-11-18 00:52         ` Bruce Momjian <pgman@candle.pha.pa.us>
  2003-11-18 07:34           ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 13+ messages in thread

From: Bruce Momjian @ 2003-11-18 00:52 UTC (permalink / raw)
  To: Hannu Krosing <hannu@tm.ee>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Hannu Krosing wrote:
> Bruce Momjian kirjutas E, 17.11.2003 kell 02:31:
> 
> > Defining now() as the first call seems pretty arbitrary to me.  I can't
> > think of any time-based interface that has that API.  And what if a
> > trigger called now() in an earlier query and you didn't even know about
> > it.
> 
> That would be OK. The whole point of that previous discussion was to
> have now() that returns the same value over the span of the whole
> transaction.

I think my issue is that there isn't any predictable way for a user to
know when the now() time is recorded.  By using start of transaction, at
least we know for sure the point in time it is showing.

> It would be even better to have now() that returns the time current
> transaction is COMMITted as this is the time other backend become aware
> of it ;)

True, but implementing that would be very hard.

-- 
  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



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with count(*))
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
  2003-11-17 00:31     ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
  2003-11-17 10:19       ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>
  2003-11-18 00:52         ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Bruce Momjian <pgman@candle.pha.pa.us>
@ 2003-11-18 07:34           ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 13+ messages in thread

From: Tom Lane @ 2003-11-18 07:34 UTC (permalink / raw)
  To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Hannu Krosing <hannu@tm.ee>; Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Hannu Krosing wrote:
>> It would be even better to have now() that returns the time current
>> transaction is COMMITted as this is the time other backend become aware
>> of it ;)

> True, but implementing that would be very hard.

Son, that was a *joke* ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 13+ messages in thread

* Re: start of transaction (was: Re: [PERFORM] Help with
  2003-11-16 23:18 ` start of transaction (was: Re: [PERFORM] Help with count(*)) Neil Conway <neilc@samurai.com>
  2003-11-17 00:08   ` Re: start of transaction (was: Re: [PERFORM] Help with count(*)) Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-11-17 10:16     ` Hannu Krosing <hannu@tm.ee>
  1 sibling, 0 replies; 13+ messages in thread

From: Hannu Krosing @ 2003-11-17 10:16 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Neil Conway <neilc@samurai.com>; Will LaShell <will@lashell.net>; Christopher Browne <cbbrowne@acm.org>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

Tom Lane kirjutas E, 17.11.2003 kell 02:08:
> Neil Conway <neilc@samurai.com> writes:
> > 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.
> 
> Well, actually, it's a bug in the interface IMHO.  But as I said in the
> last thread, it's a fairly widespread bug. 

I'm not sure that it is a client-side bug. For example Oracle seems to
_always_ have a transaction going, i.e. you can't be "outside" of
transaction, and you use just COMMIT to commit old _and_start_new_
transaction.

IIRC the same is true for DB2.

For these database the BEGIN TRANSACTION command is mainly used for
starting nested transactions, which we don't have.

> We've been taking the
> position that the interface libraries should get fixed, and that's not
> happening.  It's probably time to look at a server-side fix.

Maybe "fixing" the interface libraries would make them incompatible with
*DBC's for all other databases in some subtle ways ?

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




^ permalink  raw  reply  [nested|flat] 13+ messages in thread


end of thread, other threads:[~2003-11-18 07:34 UTC | newest]

Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-16 11:58 ` Hannu Krosing <hannu@tm.ee>
2003-11-16 14:50   ` Tom Lane <tgl@sss.pgh.pa.us>
2003-11-16 15:51     ` Re: start of transaction (was: Re: [PERFORM] Help with Dennis Bjorklund <db@zigo.dhs.org>
2003-11-16 22:55   ` Neil Conway <neilc@samurai.com>
2003-11-17 06:11     ` Greg Stark <gsstark@mit.edu>
2003-11-17 07:09       ` Re: start of transaction (was: Re: [PERFORM] Help with Stephan Szabo <sszabo@megazone.bigpanda.com>
2003-11-16 23:18 ` Neil Conway <neilc@samurai.com>
2003-11-17 00:08   ` Tom Lane <tgl@sss.pgh.pa.us>
2003-11-17 00:31     ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-17 10:19       ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>
2003-11-18 00:52         ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-11-18 07:34           ` Tom Lane <tgl@sss.pgh.pa.us>
2003-11-17 10:16     ` Re: start of transaction (was: Re: [PERFORM] Help with Hannu Krosing <hannu@tm.ee>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox