Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C0CA31337B4E for ; Mon, 15 Nov 2010 11:24:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 92599-05 for ; Mon, 15 Nov 2010 15:24:32 +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 7EAED1337B3E for ; Mon, 15 Nov 2010 11:24:32 -0400 (AST) Received: from Artur7 (cfidsl [83.18.105.226]) by wentylator.ang.com.pl (Postfix) with ESMTP id EF3582DD260 for ; Mon, 15 Nov 2010 16:24:34 +0100 (CET) From: =?iso-8859-2?Q?Artur_Zaj=B1c?= To: References: <000001cb849e$1dce2720$596a7560$@ang.com.pl> <13814.1289833979@sss.pgh.pa.us> In-Reply-To: <13814.1289833979@sss.pgh.pa.us> Subject: Re: Difference between explain analyze and real execution time Date: Mon, 15 Nov 2010 16:24:30 +0100 Message-ID: <008e01cb84d9$33797a80$9a6c6f80$@ang.com.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQFsDnYhYIkerMawLWBzle0OUvs2zwKi9oQ0lBx9oCA= 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/245 X-Sequence-Number: 41269 > EXPLAIN ANALYZE doesn't account for all of the runtime involved. In this case, I'd bet that session startup/shutdown is a big part of the difference. > > regards, tom lane Does session startup/shutdown depend on tables used in query? Some simpler query: time psql -c 'explain analyze SELECT te.idt FROM t_positions AS te WHERE te.idtr IN (347186)' QUERY PLAN ---------------------------------------------------------------------------- --------------------------------------------------------- Index Scan using tg_transelem_index1 on tg_transelem te (cost=0.00..8.43 rows=3 width=4) (actual time=0.130..0.134 rows=3 loops=1) Index Cond: (tr_idtrans = 347186) Total runtime: 0.211 ms real 0m0.017s user 0m0.002s sys 0m0.004s ------------------------------------------- Artur Zajac