Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 525F91337990 for ; Mon, 15 Nov 2010 16:44:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 62289-03 for ; Mon, 15 Nov 2010 20:43:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wentylator.ang.com.pl (wentylator.ang.com.pl [89.174.215.202]) by mail.postgresql.org (Postfix) with ESMTP id E42CA1337B51 for ; Mon, 15 Nov 2010 16:43:55 -0400 (AST) Received: from Artur7 (cfidsl [83.18.105.226]) by wentylator.ang.com.pl (Postfix) with ESMTP id 11D922DD260; Mon, 15 Nov 2010 21:43:54 +0100 (CET) From: =?iso-8859-2?Q?Artur_Zaj=B1c?= To: "'Robert Haas'" Cc: References: <000001cb849e$1dce2720$596a7560$@ang.com.pl> In-Reply-To: Subject: Re: Difference between explain analyze and real execution time Date: Mon, 15 Nov 2010 21:43:48 +0100 Message-ID: <009d01cb8505$ce738900$6b5a9b00$@ang.com.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFsDnYhYIkerMawLWBzle0OUvs2zwGxik20lCRiAyA= Content-Language: pl X-wentylator-MailScanner-Information: Please contact the ISP for more information X-wentylator-MailScanner: Found to be clean X-wentylator-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0, required 6, autolearn=not spam) X-wentylator-MailScanner-From: azajac@ang.com.pl X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/250 X-Sequence-Number: 41274 2010/11/15 Artur Zaj=B1c : > Why there is so big difference between explain analyze (0.710 ms) and=20 > real execution time (3309 ms)? Any suggestions? > Could it be that it takes a long time to plan for some reason? How = fast is a plain EXPLAIN? Yes! That is it :) Planning is painful. I'm so stupid. I didn't check = VACUUM without ANALYZE :) time psql -c 'explain SELECT te.idt FROM t_positions AS te WHERE = te.idtr IN (347186)' real 0m1.087s user 0m0.004s sys 0m0.001s I've changed default_statistics_target to 10000 and I think that is a reason. When I changed it to 1000 everything seems to be ok: time psql -c 'explain analyze SELECT te.idt FROM t_positions AS te = WHERE te.idtr IN (347186)' real 0m0.062s user 0m0.003s sys 0m0.004s Thanks. ------------------------------------------- Artur Zajac