Re: now() gives same time within the session

От: A. Kretschmer
Тема: Re: now() gives same time within the session
Дата: ,
Msg-id: 20100712111500.GA14489@a-kretschmer.de
(см: обсуждение, исходный текст)
Ответ на: now() gives same time within the session  (<>)
Ответы: Re: now() gives same time within the session  (<>)
Re: now() gives same time within the session  (Rob Wultsch)
Re: now() gives same time within the session  (Heikki Linnakangas)
Список: pgsql-performance

Скрыть дерево обсуждения

now() gives same time within the session  (<>, )
 Re: now() gives same time within the session  ("A. Kretschmer", )
  Re: now() gives same time within the session  (<>, )
  Re: now() gives same time within the session  (Rob Wultsch, )
   Re: now() gives same time within the session  (Thom Brown, )
   Re: now() gives same time within the session  ("A. Kretschmer", )
   Re: now() gives same time within the session  (Kenneth Marshall, )
  Re: now() gives same time within the session  (Heikki Linnakangas, )

In response to  :
> Hi,
>
>
>
> I need to log the start and end time of the procedures in a table. But the
> start and end time are same. This is how I recreated the issue.
>
>
>
> create table test_time (time timestamp);
>
> delete from  test_time;
>
> insert into test_time select now();


Use timeofday() instead, now() returns the transaction starting time.

BEGIN
test=*# select now();
              now
-------------------------------
 2010-07-12 13:13:28.907043+02
(1 row)

test=*# select timeofday();
              timeofday
--------------------------------------
 Mon Jul 12 13:13:36.187703 2010 CEST
(1 row)

test=*# select now();
              now
-------------------------------
 2010-07-12 13:13:28.907043+02
(1 row)

test=*#


Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99


В списке pgsql-performance по дате сообщения:

От: Bruce Momjian
Дата:
Сообщение: Re: Need help in performance tuning.
От: phb07
Дата:
Сообщение: Re: Slow query with planner row strange estimation