X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5FEC6D1D20B for ; Sun, 16 Nov 2003 11:58:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 26209-09 for ; Sun, 16 Nov 2003 07:58:26 -0400 (AST) Received: from fuji.krosing.net (217-159-136-226-dsl.kt.estpak.ee [217.159.136.226]) by svr1.postgresql.org (Postfix) with ESMTP id 7F79CD1E1A5 for ; Sun, 16 Nov 2003 07:58:22 -0400 (AST) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id hAGBwDJC017704; Sun, 16 Nov 2003 13:58:13 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id hAGBwAO2017702; Sun, 16 Nov 2003 13:58:10 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: start of transaction (was: Re: [PERFORM] Help with count(*)) From: Hannu Krosing To: Neil Conway Cc: Tom Lane , Will LaShell , Christopher Browne , "pgsql-hackers@postgresql.org" In-Reply-To: <87isllbcys.fsf@mailbox.samurai.com> References: <200311141251.38786.mallah@trade-india.com> <1068831807.2540.44.camel@fuji.krosing.net> <3FB52FA7.8060508@lashell.net> <4987.1068842326@sss.pgh.pa.us> <87isllbcys.fsf@mailbox.samurai.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1068983887.17671.10.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sun, 16 Nov 2003 13:58:08 +0200 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/838 X-Sequence-Number: 47126 Redirected to -hackers Neil Conway kirjutas L, 15.11.2003 kell 22:20: > Tom Lane 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