Skip site navigation (1) Skip section navigation (2)

Re: Measuring execution time for sql called from PL/pgSQL

From: "David Shadovitz" <david(at)www(dot)shadovitz(dot)com>
To: Aram Kananov <aram(at)kananov(dot)com>,"pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Measuring execution time for sql called from PL/pgSQL
Date: 2003-12-12 01:50:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
> 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:



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. 


In response to

pgsql-performance by date

Next:From: Alfranio Tavares Correia JuniorDate: 2003-12-12 02:35:16
Subject: Re: Performance problems with a higher number of clients
Previous:From: Aram KananovDate: 2003-12-12 01:17:06
Subject: Measuring execution time for sql called from PL/pgSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group