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

Поиск
Список
Период
Сортировка
От David Shadovitz
Тема Re: Measuring execution time for sql called from PL/pgSQL
Дата
Msg-id 20031212015031.M16173@www.shadovitz.com
обсуждение исходный текст
Ответ на Measuring execution time for sql called from PL/pgSQL  (Aram Kananov <aram@kananov.com>)
Список 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:

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

В списке pgsql-performance по дате отправления:

Предыдущее
От: "Chadwick, Russell"
Дата:
Сообщение: Excessive rows/tuples seriously degrading query performance
Следующее
От: "Nick Fankhauser - Doxpop"
Дата:
Сообщение: Nested loop question