clock sync

clock sync

Post by John Li » Fri, 10 Jan 2003 23:40:11



How do I know the clock on the machine you're
running on will be set to the same time as the
clock on the database? how postgre handle this
internal?

thanks.

johnl

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

 
 
 

clock sync

Post by cbbro.. » Sat, 11 Jan 2003 00:51:58


On Thu, 09 Jan 2003 08:39:33 CST, the world broke into rejoicing as

Quote:> How do I know the clock on the machine you're
> running on will be set to the same time as the
> clock on the database? how postgre handle this
> internal?

You'll know because you already run NTP on all your servers to make
sure that they are synchronizing times, right?

PostgreSQL doesn't include time synchronization software because NTP
does that perfectly well, just as it doesn't include a job scheduler
because cron does that perfectly well.

... And if your machines have substantially different times, different
sorts of issues will emerge depending on what you're doing.

- If the "client" sends over literal current time stamps based on what
time it thinks it is, that may differ from what time the server thinks
it is.

- If you do that, and then try looking in PostgreSQL logs, based on
the "client's" timestamps, you'll look at the wrong times, and get
confused.

- If the client passes in things that select now(), timestamps will be
returned based on when the /server/ thinks it is.  Which should leave
the database consistent, but which might confuse the client if it has
logic that processes that time, and gets deranged because now()
differs massively from what time it thinks it is.

The case where you'll get /badly/ bitten is if you're trying to do
replication with servers that have substantially differing ideas as to
what time it is.

But what you /should/ do is run NTP on all your machines, thus getting
rid of the problem.  <http://www.ntp.org/>
--
If this was helpful, <http://svcs.affero.net/rm.php?r=cbbrowne> rate me
http://www3.sympatico.ca/cbbrowne/ntp.html
Rules  of the  Evil  Overlord #30.   "All  bumbling conjurers,  clumsy
squires, no-talent  bards, and  cowardly thieves in  the land  will be
preemptively put  to death.  My foes  will surely give  up and abandon
their quest if they have no source of comic relief."
<http://www.eviloverlord.com/>

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org