Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id E2B0A9FA173 for ; Thu, 14 Dec 2006 12:41:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 40795-10 for ; Thu, 14 Dec 2006 12:41:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D300D9FA182 for ; Thu, 14 Dec 2006 12:41:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kBEGfFcd021517; Thu, 14 Dec 2006 11:41:15 -0500 (EST) To: Evgeny Gridasov cc: pgsql-performance@postgresql.org Subject: Re: EXPLAIN ANALYZE on 8.2 In-reply-to: <20061214192920.c75385d6.eugrid@fpm.kubsu.ru> References: <20061214163230.d46f0138.eugrid@fpm.kubsu.ru> <21146.1166112702@sss.pgh.pa.us> <20061214192920.c75385d6.eugrid@fpm.kubsu.ru> Comments: In-reply-to Evgeny Gridasov message dated "Thu, 14 Dec 2006 19:29:20 +0300" Date: Thu, 14 Dec 2006 11:41:15 -0500 Message-ID: <21516.1166114475@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/377 X-Sequence-Number: 22433 Evgeny Gridasov writes: > This is a Linux Debian 3.1 ontop of 2x XEON 3.4 Ghz. > PostgreSQL is 8.2 checked out from CVS REL8_2_STABLE yesterday. > I'm running the same Postgres on another machine, > with Debian Etch and have the same results. Hmph. With 8.2 on Fedora 5 on a 2.8Ghz dual Xeon, I get this: regression=# create table foo as select x from generate_series(1,2500000) x; SELECT regression=# vacuum foo; VACUUM regression=# checkpoint; CHECKPOINT regression=# \timing Timing is on. regression=# select count(*) from foo; count --------- 2500000 (1 row) Time: 666.639 ms regression=# select count(*) from foo; count --------- 2500000 (1 row) Time: 609.514 ms regression=# explain analyze select count(*) from foo; QUERY PLAN --------------------------------------------------------------------------------------------------------------------- Aggregate (cost=44764.00..44764.01 rows=1 width=0) (actual time=1344.812..1344.813 rows=1 loops=1) -> Seq Scan on foo (cost=0.00..38514.00 rows=2500000 width=0) (actual time=0.031..748.571 rows=2500000 loops=1) Total runtime: 1344.891 ms (3 rows) Time: 1345.755 ms regression=# explain analyze select count(*) from foo; QUERY PLAN --------------------------------------------------------------------------------------------------------------------- Aggregate (cost=44764.00..44764.01 rows=1 width=0) (actual time=1324.846..1324.847 rows=1 loops=1) -> Seq Scan on foo (cost=0.00..38514.00 rows=2500000 width=0) (actual time=0.046..748.582 rows=2500000 loops=1) Total runtime: 1324.902 ms (3 rows) Time: 1325.591 ms regression=# which works out to about 0.14 microsec per gettimeofday call, on a machine that ought to be slower than yours. So I think you've got either a crummy motherboard, or a kernel that doesn't know the best way to read the clock on that hardware. There is some discussion of this in the archives (probably in pgsql-hackers); look back around May or so when we were unsuccessfully trying to hack EXPLAIN to use fewer gettimeofday calls. regards, tom lane