Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Is now() atomic?




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(at)genenames(dot)org
European Bioinformatics Institute
Hinxton, Cambridge
URL: http://www.genenames.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group