I'm writing a reporting script (on postgres 8.1) that logs some table
stats along with the time, I'd like to write something like this:-

SELECT now(), foo, COUNT(*) FROM table GROUP BY foo;

now | foo | count
--------------------------------+-------+-------
13/12/2007 16:04:49.044687 GMT | A | 21499
13/12/2007 16:04:49.044687 GMT | B | 2517
13/12/2007 16:04:49.044687 GMT | C | 245
.
.
13/12/2007 16:04:49.044687 GMT | ZZZ | 23016

Does now() record the time that the SELECT statement was executed
or the time that the row is printed out?

ie is it possible for the clock to tick during the SELECT resulting in:-

now | foo | count
--------------------------------+-------+-------
13/12/2007 16:04:49.044687 GMT | A | 21499
.
.
13/12/2007 16:04:49.044688 GMT | ZZZ | 23016


--
Michael

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael John Lush PhD Tel:44-1223 492626
Bioinformatician
HUGO Gene Nomenclature Committee Email: hgnc@genenames.org
European Bioinformatics Institute
Hinxton, Cambridge
URL: http://www.genenames.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedDec 13, '07 at 4:33p
activeDec 13, '07 at 4:37p
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Tom Lane: 1 post Michael Lush: 1 post

People

Translate

site design / logo © 2022 Grokbase