pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
Date: Wed, 12 Jan 2011 10:07:53 -0500
Message-ID: <25677.1294844873@sss.pgh.pa.us> (raw)
In-Reply-To: <201101121318.44007.achill@matrix.gatewaynet.com>
References: <201101111753.22602.achill@matrix.gatewaynet.com>
	<18991.1294762751@sss.pgh.pa.us>
	<201101121318.44007.achill@matrix.gatewaynet.com>

Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> Regarding gettimeofday (2), i wrote this program :
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/time.h>
> int main(int argc,char** argv) {
>         struct timeval *tp=calloc(1,sizeof(struct timeval));
>         int runna;
>         for (runna=0;runna<1000000;runna++) {
>                 int rc=gettimeofday(tp,NULL);
>                 long micros = tp->tv_sec * 1000000 + tp->tv_usec;
>                 printf("cur_time=%u micro secs\n",micros);
>         }
> }

Right offhand I'd wonder whether that was more bound by gettimeofday or
by printf.  Please try it without printf in the loop.

> 3) Test machine (thereafter called FBSD_TEST) :
> System: FreeBSD 8.1, 4 x AMD Phenom(tm) 965 @ 3.4 GHz, 8GB memory
> DB: PostgreSQL 9.0.2, shared_buffers=5GB, work_mem=512MB, db size=7GB

The shared_buffers setting seems way out of line compared to actual
memory on this machine.  Maybe it's swapping.

> i get the following execution times: (with \timing) (note however that FBSD_DEV has a considerably smaller database, the other two are compareable)
> FBSD_DEV : query : 240,419 ms, EXPLAIN ANALYZE query : Total runtime: 538.468 ms
> LINUX_PROD : query : 219.568 ms, EXPLAIN ANALYZE query : Total runtime: 216.926 ms
> FBSD_TEST : query : 2587,465 ms, EPXLAIN ANALYZE query : Total runtime: 93711.648 ms
> The last numbers seem huge.

Are they in fact the same query plans in each case?

			regards, tom lane



view thread (25+ messages)  latest in thread

Message-ID: <25677.1294844873@sss.pgh.pa.us>
Permalink:  ../25677.1294844873@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25677.1294844873@sss.pgh.pa.us

 · 

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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, achill@matrix.gatewaynet.com
  Subject: Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
  In-Reply-To: <25677.1294844873@sss.pgh.pa.us>

* 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