pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Now() in a function
2+ messages / 2 participants
[nested] [flat]

* Now() in a function
@ 2003-11-06 22:43  sTesting <stesting@hotmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: sTesting @ 2003-11-06 22:43 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I have a big problem, i wrote a very long function that is taking so much time. inside this function i added few debugging steps to find which section is taking most of the time, but all the created records have the same time in them, the time where the fuction begins.
I tried to different methods:
INSERT INTO f_error (error_id, creation_date)
VALUES (nextval(''s_f_error_id''), now());

INSERT INTO f_error (error_id, creation_date)
VALUES (nextval(''s_f_error_id''), ''now'');

Tanks in advance for your help.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Now() in a function
@ 2003-11-06 23:19  Gaetano Mendola <mendola@bigfoot.com>
  parent: sTesting <stesting@hotmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Gaetano Mendola @ 2003-11-06 23:19 UTC (permalink / raw)
  To: pgsql-sql

sTesting wrote:

> Hi,
>  
> I have a big problem, i wrote a very long function that is taking so 
> much time. inside this function i added few debugging steps to find 
> which section is taking most of the time, but all the created records 
> have the same time in them, the time where the fuction begins.
> I tried to different methods:
> INSERT INTO f_error (error_id, creation_date)
> VALUES (nextval(''s_f_error_id''), now());
>  
> INSERT INTO f_error (error_id, creation_date)
> VALUES (nextval(''s_f_error_id''), ''now'');

now() give you the time when the transaction started,
so what you see is the intended behavior, in your case you must use:
timeofday().


Regards
Gaetano Mendola




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-11-06 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-06 22:43 Now() in a function sTesting <stesting@hotmail.com>
2003-11-06 23:19 ` Gaetano Mendola <mendola@bigfoot.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox