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: Magnus Hagander <mha(at)sollentuna(dot)net>,Ken Egervari <ken(at)upfactor(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-07 17:24:07
Message-ID: 422C8E37.8000009@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:
>
>
>>>>Can we just replace gettimeofday() with a version that's basically:
>>>>
>>>>
>>>No, because it's also used for actual time-of-day calls.  It'd be
>>>necessary to hack executor/instrument.c in particular.
>>>
>>>
>
>
>
>>Or we modify the win32 gettimeofday call to something like:
>>
>>
>
>That's what Magnus was talking about, but it's really no good because
>it would cause Postgres' now() function to fail to track post-boot-time
>changes in the system date setting.  Which I think would rightly be
>considered a bug.
>
>The EXPLAIN ANALYZE instrumentation code will really be happier with a
>straight time-since-bootup counter; by using gettimeofday, it is
>vulnerable to giving wrong answers if someone changes the date setting
>while the EXPLAIN is running.  But there is (AFAIK) no such call among
>the portable Unix syscalls.  It seems reasonable to me to #ifdef that
>code to make use of QueryPerformanceCounter on Windows.  This does not
>mean we want to alter the behavior of gettimeofday() where it's being
>used to find out the time of day.
>
>			regards, tom lane
>
>
>

What if you changed the "initialized" to

if (count & 0xFF == 0) {
  count = 1;
  // get the new time of day
}
++count;

Then we would only be wrong for 256 gettimeofday calls. I agree it isn't
great, though. And probably better to just abstract (possibly just with
#ifdef) the calls for accurate timing, from the calls that actually need
the real time.

John
=:->


In response to

Responses

pgsql-performance by date

Next:From: Josh BerkusDate: 2005-03-07 17:28:47
Subject: Re: Help trying to tune query that executes 40x slower than in SqlServer
Previous:From: Hugo FerreiraDate: 2005-03-07 17:01:58
Subject: Help trying to tune query that executes 40x slower than in SqlServer

pgsql-hackers-win32 by date

Next:From: Greg StarkDate: 2005-03-07 18:05:30
Subject: Re: [PERFORM] Help with tuning this query (with
Previous:From: Tom LaneDate: 2005-03-07 16:38:51
Subject: Re: [PERFORM] Help with tuning this query (with explain analyze finally)

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