Re: Where does the time go?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Where does the time go?
Date: 2006-03-23 19:47:04
Message-ID: 20060323194704.GA17969@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, Mar 23, 2006 at 12:29:27PM -0600, Kevin Grittner wrote:
> > Works out to about 30 microsec per node execution, which seems a
> > bit high for modern machines ... and the coarse quantization of the
> > CURRENT_TIMESTAMP results is odd too. What platform is this on
> > exactly?
>
> This is a smaller machine with a copy of the full production database.
> A single 3.6 GHz Xeon with 4 GB RAM running Windows Server 2003. It was
> being used to test update scripts before applying them to the production
> machines. I stumbled across a costing issue I thought worth posting,
> and in the course of gathering data noticed this time difference I
> didn't understand.

This may be the cause of the problem (windows). On UNIX platforms the
gettimeofday() call is used to calculate the timings in both cases. On
Windows the EXPLAIN ANALYZE measures time in a different way using the
CPU counters. It uses the interface but it will run into issues if the
CPU speed is not properly calculated or there is drift between the
different CPUs.

Here's one person who claims that the performance counter frequency is
often wrong:

http://archives.postgresql.org/pgsql-hackers-win32/2005-03/msg00063.php

It's also been pointed out before that the code actually divides by the
wrong number (it uses GetTimerFrequency() rather than
QueryPerformenceFrequency()). If you can find the values of these two
functions on your machine, see how it compares to your actual clock
speed.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-03-23 19:50:18 Re: Static build of psql with readline support
Previous Message Kevin Grittner 2006-03-23 18:55:07 Re: Where does the time go?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-03-23 19:55:36 Re: Where does the time go?
Previous Message Mark Wong 2006-03-23 19:27:45 Re: WIP: splitting BLCKSZ