Re: measure time intervals

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Vincent Dautremont <vincent(at)searidgetech(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: measure time intervals
Date: 2012-04-10 13:46:27
Message-ID: CAHyXU0ynLSKNMrUzoX5D2Wh6HVbAuFPY3Xyn8ws8riNBKbKS7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 5, 2012 at 9:00 AM, Vincent Dautremont
<vincent(at)searidgetech(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2012-04-10 13:48:11 Re: measure time intervals
Previous Message Vincent Dautremont 2012-04-10 13:39:13 Re: measure time intervals