X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 68E819FA5FC for ; Fri, 30 Jun 2006 03:05:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 40045-09 for ; Fri, 30 Jun 2006 03:04:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E11A09FA0EC for ; Fri, 30 Jun 2006 03:04:52 -0300 (ADT) 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 k5U64nTR020525; Fri, 30 Jun 2006 02:04:49 -0400 (EDT) To: "Craig A. James" cc: pgsql-performance@postgresql.org Subject: Re: explain analyze reports 20x more time than actual In-reply-to: <44A4AE1A.4070308@modgraph-usa.com> References: <448C505C.2080504@modgraph-usa.com> <87ac8jfu7t.fsf@stark.xeocode.com> <448E5A92.9050206@modgraph-usa.com> <22609.1150209419@sss.pgh.pa.us> <44A4AE1A.4070308@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Thu, 29 Jun 2006 21:52:42 -0700" Date: Fri, 30 Jun 2006 02:04:49 -0400 Message-ID: <20524.1151647489@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/490 X-Sequence-Number: 19847 "Craig A. James" writes: > I have a query that needs to run faster, with the obvious solution > being to add an index. But to confirm this, I ran explain analyze. > When I run the actual query, it consistently takes 6-7 seconds by the > wall clock. My application with a "verbose" mode enabled reports 6.6 > seconds consistently. However, when I run EXPLAIN ANALYZE, it takes > 120 seconds! See recent discussions --- if you've got duff PC hardware, it seems that reading the clock takes forever :-(. In this case I'd assume that the cost of the seqscan (11497361 rows returned) is being overstated because of the 2*11497361 gettimeofday calls involved. regards, tom lane