X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 940DAD1B507 for ; Fri, 12 Dec 2003 01:57:48 +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 48748-06 for ; Thu, 11 Dec 2003 21:57:20 -0400 (AST) Received: from www.smart-start-hosting.com (unknown [38.118.153.169]) by svr1.postgresql.org (Postfix) with ESMTP id 74D23D1B454 for ; Thu, 11 Dec 2003 21:57:16 -0400 (AST) Received: from shadovitz.com (localhost [127.0.0.1]) by localhost (8.10.2/8.10.2) with ESMTP id hBC1oVm20348; Thu, 11 Dec 2003 17:50:31 -0800 From: "David Shadovitz" To: Aram Kananov , "pgsql-performance@postgresql.org" Subject: Re: Measuring execution time for sql called from PL/pgSQL Date: Thu, 11 Dec 2003 18:50:31 -0700 Message-Id: <20031212015031.M16173@www.shadovitz.com> In-Reply-To: <1071191825.5163.164.camel@localhost.localdomain> References: <1071191825.5163.164.camel@localhost.localdomain> X-Mailer: Open WebMail 1.81 20021203 X-OriginatingIP: 216.180.56.31 (david@shadovitz.com) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/236 X-Sequence-Number: 5096 > I've tried to measure the duration of sql with printing out > "localtimestamp" but for some reason during the same pg/plsql call > it returns the same value: Aram, From http://www.postgresql.org/docs/current/static/functions-datetime.html: There is also the function timeofday(), which for historical reasons returns a text string rather than a timestamp value: SELECT timeofday(); Result: Sat Feb 17 19:07:32.000126 2001 EST It is important to know that CURRENT_TIMESTAMP and related functions return the start time of the current transaction; their values do not change during the transaction. This is considered a feature: the intent is to allow a single transaction to have a consistent notion of the "current" time, so that multiple modifications within the same transaction bear the same time stamp. timeofday() returns the wall-clock time and does advance during transactions. -David