X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76BCF8B9EB9 for ; Sun, 6 Feb 2005 22:46:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64997-08 for ; Sun, 6 Feb 2005 22:46:05 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 490628B9E5B for ; Sun, 6 Feb 2005 22:46:06 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j16Mk6ZK017153; Sun, 6 Feb 2005 17:46:06 -0500 (EST) To: "Steven Rosenstein" Cc: pgsql-performance@postgresql.org Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? In-reply-to: References: Comments: In-reply-to "Leeuw van der, Tim" message dated "Sun, 06 Feb 2005 23:09:52 +0100" Date: Sun, 06 Feb 2005 17:46:05 -0500 Message-ID: <17152.1107729965@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/103 X-Sequence-Number: 10432 > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Steven Rosenstein > >> I don't think EXPLAIN ANALYZE puts that much overhead on a query. I think you're being overly optimistic. The explain shows that the Materialize subnode is being entered upwards of 32 million times: -> Materialize (cost=505.06..511.38 rows=632 width=4) (actual time=0.00..0.02 rows=43 loops=752066) 43 * 752066 = 32338838. The instrumentation overhead is basically two gettimeofday() kernel calls per node entry. Doing the math shows that your machine is able to do gettimeofday() in about half a microsecond, which isn't stellar but it's not all that slow for a kernel call. (What's the platform here, anyway?) Nonetheless it's a couple of times larger than the actual time needed to pull a row from a materialized array ... The real answer to your question is "IN (subselect) sucks before PG 7.4; get a newer release". regards, tom lane