Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time - Mailing list pgsql-admin

From Tom Lane
Subject Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
Date
Msg-id 25677.1294844873@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
List pgsql-admin
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,
theother 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

pgsql-admin by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time
Next
From: Achilleas Mantzios
Date:
Subject: Re: Postgresql 9.0.2 explain analyze very slow (10x), compared to actual query time