Thread: measure time intervals
Hi,
I'm wondering ig it is possible to measure elapsed time between 2 particular queries in PostgreSQL.
what I need is the equivalent of @@TIMETICKS in Transac-SQL
or CLOCK_MONOTONIC in Unix
or GetTickCount in Windows
These are not affected by system time changes, so time interval can be calculated even if the system time is changed by NTP or the user.
That's why I can't use any function based on system time.
I'm wondering ig it is possible to measure elapsed time between 2 particular queries in PostgreSQL.
what I need is the equivalent of @@TIMETICKS in Transac-SQL
or CLOCK_MONOTONIC in Unix
or GetTickCount in Windows
These are not affected by system time changes, so time interval can be calculated even if the system time is changed by NTP or the user.
That's why I can't use any function based on system time.
On 04/05/12 7:00 AM, Vincent Dautremont wrote: > These are not affected by system time changes, so time interval can be > calculated even if the system time is changed by NTP or the user. > That's why I can't use any function based on system time. properly configured Unix NTP doesn't step-change the clock, it very gently slows it down or speeds it up until it is accurate and maintains stability. and only root can change the clock on a Unix system, so this really shouldn't be a concern. -- john r pierce N 37, W 122 santa cruz ca mid-left coast
Thank you but my problem is precisely because I'm using Postrgresql on a windows computer and I cannot change that :-/
Vincent.
Vincent.
On Fri, Apr 6, 2012 at 1:40 PM, John R Pierce <pierce@hogranch.com> wrote:
On 04/05/12 7:00 AM, Vincent Dautremont wrote:properly configured Unix NTP doesn't step-change the clock, it very gently slows it down or speeds it up until it is accurate and maintains stability. and only root can change the clock on a Unix system, so this really shouldn't be a concern.These are not affected by system time changes, so time interval can be calculated even if the system time is changed by NTP or the user.
That's why I can't use any function based on system time.
--
john r pierce N 37, W 122
santa cruz ca mid-left coast
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Thu, Apr 5, 2012 at 9:00 AM, Vincent Dautremont <vincent@searidgetech.com> wrote: > Hi, > I'm wondering ig it is possible to measure elapsed time between 2 particular > queries in PostgreSQL. > > what I need is the equivalent of @@TIMETICKS in Transac-SQL > or CLOCK_MONOTONIC in Unix > or GetTickCount in Windows > > These are not affected by system time changes, so time interval can be > calculated even if the system time is changed by NTP or the user. > That's why I can't use any function based on system time. one way that will work is to write a C module for postgres that wraps the system call. that's a heavy dependency for such a small thing though. also FYI GetTickCount wraps around approximately every three and a half weeks. merlin
On 10/04/2012 14:39, Vincent Dautremont wrote: > Thank you but my problem is precisely because I'm using Postrgresql on a > windows computer and I cannot change that :-/ Windows can adjust the time using NTP also, though I don't know how abruptly or otherwise it does it. Under your date & time settings there should be an "Internet time" tab. There are also some Windows NTP clients which might be worth looking at. Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
Thank you.
I was searching if there was such feature included in postgresql.
I'll find another way around to achieve what I want with this.
As I have to use windows NTP colient and not a 3rd party client I'll go check windows NTP client configuration, see if I can make it act as the Unix one does.
Vincent.
I was searching if there was such feature included in postgresql.
I'll find another way around to achieve what I want with this.
As I have to use windows NTP colient and not a 3rd party client I'll go check windows NTP client configuration, see if I can make it act as the Unix one does.
Vincent.
On Tue, Apr 10, 2012 at 9:48 AM, Raymond O'Donnell <rod@iol.ie> wrote:
On 10/04/2012 14:39, Vincent Dautremont wrote:Windows can adjust the time using NTP also, though I don't know how
> Thank you but my problem is precisely because I'm using Postrgresql on a
> windows computer and I cannot change that :-/
abruptly or otherwise it does it. Under your date & time settings there
should be an "Internet time" tab.
There are also some Windows NTP clients which might be worth looking at.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie
On 04/10/12 6:48 AM, Raymond O'Donnell wrote: > Windows can adjust the time using NTP also, though I don't know how > abruptly or otherwise it does it. Under your date & time settings > there should be an "Internet time" tab. the built in Windows Internet Time does a time step every 24 hours(or something) to correct it, or at least it did this last time I looked into it. -- john r pierce N 37, W 122 santa cruz ca mid-left coast