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

Re: [PERFORM] Help with tuning this query (with

From: John A Meinel <john(at)arbash-meinel(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Held <dave(dot)held(at)arrayservicesgrp(dot)com>,pgsql-performance(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: [PERFORM] Help with tuning this query (with
Date: 2005-03-08 04:35:09
Message-ID: 422D2B7D.5080702@arbash-meinel.com (view raw or flat)
Thread:
Lists: pgsql-hackers-win32pgsql-performance
Tom Lane wrote:

>John A Meinel <john(at)arbash-meinel(dot)com> writes:
>  
>
>>Dave Held wrote:
>>    
>>
>>>There is always clock().
>>>      
>>>
>
>  
>
>>My experience with clock() on win32 is that CLOCKS_PER_SEC was 1000, and 
>>it had a resolution of 55clocks / s. When I just did this:
>>    
>>
>
>The other problem is it measures process CPU time, not elapsed time
>which is probably more significant for our purposes.
>
>Which brings up a question: just what does QueryPerformanceCounter
>measure?
>
>			regards, tom lane
>  
>
clock() according to the Visual Studio Help measures wall clock time. 
But you're right, POSIX says it is approximation of processor time.

The docs don't say specifically what QueryPerformanceCounter() measures, 
but states

> The *QueryPerformanceCounter* function retrieves the current value of 
> the high-resolution performance counter.
>
It also states:

>
>         Remarks
>
> On a multiprocessor machine, it should not matter which processor is 
> called. However, you can get different results on different processors 
> due to bugs in the BIOS or the HAL. To specify processor affinity for 
> a thread, use the *SetThreadAffinityMask* function.
>

So it sounds like it is actually querying some counter independent of 
processing.

In fact, there is also this statement:

> *QueryPerformanceFrequency*
>
> The QueryPerformanceFrequency function retrieves the frequency of the 
> high-resolution performance counter, if one exists. The frequency 
> cannot change while the system is running.
>
If that is accurate, it would make QueryPerformanceCounter independent 
of things like speed stepping, etc. So again, it sounds independent of 
processing.

John
=:->

In response to

pgsql-performance by date

Next:From: John A MeinelDate: 2005-03-08 04:46:37
Subject: Re: adding 'limit' leads to very slow query
Previous:From: PFCDate: 2005-03-08 03:51:43
Subject: Re: [PERFORM] Help with tuning this query (with

pgsql-hackers-win32 by date

Next:From: Magnus HaganderDate: 2005-03-08 09:05:08
Subject: Re: [PERFORM] Help with tuning this query (with
Previous:From: PFCDate: 2005-03-08 03:51:43
Subject: Re: [PERFORM] Help with tuning this query (with

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group