pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feednow() gives same time within the session
8+ messages / 6 participants
[nested] [flat]
* now() gives same time within the session
@ 2010-07-12 11:00 Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 1 reply; 8+ messages in thread
From: Atul.Goel@globaldatapoint.com @ 2010-07-12 11:00 UTC (permalink / raw)
To: pgsql-performance
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();
SELECT pg_sleep(10);
insert into test_time select now();
SELECT pg_sleep(10);
insert into test_time select now();
SELECT pg_sleep(10);
insert into test_time select now();
SELECT pg_sleep(10);
select * from test_time;
"2010-07-12 12:43:40.509746"
"2010-07-12 12:43:40.509746"
"2010-07-12 12:43:40.509746"
"2010-07-12 12:43:40.509746"
Atul Goel
SENIOR DEVELOPER
Global DataPoint
Middlesex House, 34-42 Cleveland Street
London W1T 4LB, UK
T: +44 (0)20 7079 4827
M: +44 (0)7846765098
www.globaldatapoint.com<http://www.globaldatapoint.com/;
This e-mail is confidential and should not be used by anyone who is not the original intended recipient. Global DataPoint Limited does not accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Global DataPoint Limited. No contracts may be concluded on behalf of Global DataPoint Limited by means of e-mail communication. Global DataPoint Limited Registered in England and Wales with registered number 3739752 Registered Office Middlesex House, 34-42 Cleveland Street, London W1T 4LB
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
@ 2010-07-12 11:15 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 12:23 ` Re: now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 13:11 ` Re: now() gives same time within the session Rob Wultsch <wultsch@gmail.com>
2010-07-18 08:54 ` Re: now() gives same time within the session Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
0 siblings, 3 replies; 8+ messages in thread
From: A. Kretschmer @ 2010-07-12 11:15 UTC (permalink / raw)
To: pgsql-performance
In response to Atul.Goel@globaldatapoint.com :
> 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2010-07-12 12:23 ` Atul.Goel@globaldatapoint.com
2 siblings, 0 replies; 8+ messages in thread
From: Atul.Goel@globaldatapoint.com @ 2010-07-12 12:23 UTC (permalink / raw)
To: andreas.kretschmer@schollglas.com; pgsql-performance
Sure thanks a lot.
Regards,
Atul Goel
-----Original Message-----
From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of A. Kretschmer
Sent: 12 July 2010 12:15
To: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] now() gives same time within the session
In response to Atul.Goel@globaldatapoint.com :
> 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
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
This e-mail is confidential and should not be used by anyone who is not the original intended recipient. Global DataPoint Limited does not accept liability for any statements made which are clearly the sender's own and not expressly made on behalf of Global DataPoint Limited. No contracts may be concluded on behalf of Global DataPoint Limited by means of e-mail communication. Global DataPoint Limited Registered in England and Wales with registered number 3739752 Registered Office Middlesex House, 34-42 Cleveland Street, London W1T 4LB
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2010-07-12 13:11 ` Rob Wultsch <wultsch@gmail.com>
2010-07-12 13:23 ` Re: now() gives same time within the session Thom Brown <thombrown@gmail.com>
2010-07-12 13:24 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 13:26 ` Re: now() gives same time within the session Kenneth Marshall <ktm@rice.edu>
2 siblings, 3 replies; 8+ messages in thread
From: Rob Wultsch @ 2010-07-12 13:11 UTC (permalink / raw)
To: A. Kretschmer <andreas.kretschmer@schollglas.com>; +Cc: pgsql-performance
On Mon, Jul 12, 2010 at 4:15 AM, A. Kretschmer
<andreas.kretschmer@schollglas.com> wrote:
> In response to Atul.Goel@globaldatapoint.com :
>> 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.
Is this part of the SQL standard?
--
Rob Wultsch
wultsch@gmail.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 13:11 ` Re: now() gives same time within the session Rob Wultsch <wultsch@gmail.com>
@ 2010-07-12 13:23 ` Thom Brown <thombrown@gmail.com>
2 siblings, 0 replies; 8+ messages in thread
From: Thom Brown @ 2010-07-12 13:23 UTC (permalink / raw)
To: Rob Wultsch <wultsch@gmail.com>; +Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>; pgsql-performance
On 12 July 2010 14:11, Rob Wultsch <wultsch@gmail.com> wrote:
> On Mon, Jul 12, 2010 at 4:15 AM, A. Kretschmer
> <andreas.kretschmer@schollglas.com> wrote:
>> In response to Atul.Goel@globaldatapoint.com :
>>> 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.
>
>
> Is this part of the SQL standard?
>
I don't believe it is. See
http://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT
for more info.
Thom
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 13:11 ` Re: now() gives same time within the session Rob Wultsch <wultsch@gmail.com>
@ 2010-07-12 13:24 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2 siblings, 0 replies; 8+ messages in thread
From: A. Kretschmer @ 2010-07-12 13:24 UTC (permalink / raw)
To: pgsql-performance
In response to Rob Wultsch :
> On Mon, Jul 12, 2010 at 4:15 AM, A. Kretschmer
> <andreas.kretschmer@schollglas.com> wrote:
> > Use timeofday() instead, now() returns the transaction starting time.
>
>
> Is this part of the SQL standard?
Don't know, sorry.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 13:11 ` Re: now() gives same time within the session Rob Wultsch <wultsch@gmail.com>
@ 2010-07-12 13:26 ` Kenneth Marshall <ktm@rice.edu>
2 siblings, 0 replies; 8+ messages in thread
From: Kenneth Marshall @ 2010-07-12 13:26 UTC (permalink / raw)
To: Rob Wultsch <wultsch@gmail.com>; +Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>; pgsql-performance
On Mon, Jul 12, 2010 at 06:11:31AM -0700, Rob Wultsch wrote:
> On Mon, Jul 12, 2010 at 4:15 AM, A. Kretschmer
> <andreas.kretschmer@schollglas.com> wrote:
> > In response to Atul.Goel@globaldatapoint.com :
> >> 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.
>
>
> Is this part of the SQL standard?
>
No, see section 9.9.4 of the manual.
Cheers,
Ken
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: now() gives same time within the session
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` Re: now() gives same time within the session A. Kretschmer <andreas.kretschmer@schollglas.com>
@ 2010-07-18 08:54 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2 siblings, 0 replies; 8+ messages in thread
From: Heikki Linnakangas @ 2010-07-18 08:54 UTC (permalink / raw)
To: A. Kretschmer <andreas.kretschmer@schollglas.com>; +Cc: pgsql-performance
On 12/07/10 14:15, A. Kretschmer wrote:
> Use timeofday() instead, now() returns the transaction starting time.
timeofday() is a legacy function kept only for backwards-compatibility.
It returns a string, which is quite awkward. Use clock_timestamp() instead.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2010-07-18 08:54 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-12 11:00 now() gives same time within the session Atul.Goel@globaldatapoint.com
2010-07-12 11:15 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 12:23 ` Atul.Goel@globaldatapoint.com
2010-07-12 13:11 ` Rob Wultsch <wultsch@gmail.com>
2010-07-12 13:23 ` Thom Brown <thombrown@gmail.com>
2010-07-12 13:24 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2010-07-12 13:26 ` Kenneth Marshall <ktm@rice.edu>
2010-07-18 08:54 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.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