pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John A Meinel <john@arbash-meinel.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ken Egervari <ken@upfactor.com>
Cc: Ragnar Hafstaư <gnari@simnet.is>
Cc: pgsql-performance@postgresql.org
Subject: Re: Help with tuning this query (with explain analyze finally)
Date: Wed, 02 Mar 2005 17:25:10 -0600
Message-ID: <42264B56.40007@arbash-meinel.com> (raw)
In-Reply-To: <13490.1109795370@sss.pgh.pa.us>
References: <001001c51ef4$3849eeb0$6a01a8c0@KEN>
	<1109787227.31084.12.camel@localhost.localdomain>
	<000901c51f55$aa4b7400$6a01a8c0@KEN>
	<1109789394.31084.20.camel@localhost.localdomain>
	<000601c51f63$63c8bb10$6a01a8c0@KEN>
	<13490.1109795370@sss.pgh.pa.us>

Tom Lane wrote:

>"Ken Egervari" <ken@upfactor.com> writes:
>  
>
>>Okay, here is the explain analyze I managed to get from work.
>>    
>>
>
>What platform is this on?  It seems very strange/fishy that all the
>actual-time values are exact integral milliseconds.
>
>	
>
I always get round milliseconds on running. In fact, I think I've seen 
cases where it was actually rounding to 15/16ms. Which is the resolution 
of the "clock()" call (IIRC).

This is the function I have for returning time better than clock(), but 
it looks like it is still stuck no better than 1ms.
/*
 * MSVC has a function called _ftime64, which is in
 * "sys/timeb.h", which should be accurate to milliseconds
 */

#include <sys/types.h>
#include <sys/timeb.h>

double mf::getTime()
{
    struct __timeb64 timeNow;
    _ftime64(&timeNow);
    return timeNow.time + timeNow.millitm / 1000.0;
}

I did, however, find this page:
http://www.wideman-one.com/gw/tech/dataacq/wintiming.htm

Which talks about the high performance counter, which is supposed to be 
able to get better than 1us resolution.

GetSystemTimes() returns the idle/kernel/user times, and seems to have a 
resolution of about 100ns (.1us) GetLocalTime()/GetSystemTime() only has 
a resolution of milliseconds.

In my simple test, I was actually getting timings with a resolution of 
.3us for the QueryPerformanceCounter(). That was the overhead of just 
the call, since it was called either in a bare loop, or just one after 
the other.

So probably we just need to switch to QueryPerformanceCounter() 
[/Frequency].

John
=:->

Attachments:

  signature.asc (application/pgp-signature, 252B) download

view thread (26+ messages)  latest in thread

Message-ID: <42264B56.40007@arbash-meinel.com>
Permalink:  ../42264B56.40007@arbash-meinel.com/
Also on:    postgresql.org/message-id/42264B56.40007@arbash-meinel.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: john@arbash-meinel.com, tgl@sss.pgh.pa.us, ken@upfactor.com, gnari@simnet.is
  Subject: Re: Help with tuning this query (with explain analyze finally)
  In-Reply-To: <42264B56.40007@arbash-meinel.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox