X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 37D3F9DCC71 for ; Thu, 16 Feb 2006 16:39:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88101-08 for ; Thu, 16 Feb 2006 16:39:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from r1.mycybernet.net (r1.mycybernet.net [209.5.206.8]) by postgresql.org (Postfix) with ESMTP id 02F349DCC63 for ; Thu, 16 Feb 2006 16:39:25 -0400 (AST) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227]:34088 helo=phlogiston.dydns.org) by r1.mycybernet.net with esmtp (Exim 4.50 (FreeBSD)) id 1F9puR-000FQ8-8w for pgsql-sql@postgresql.org; Thu, 16 Feb 2006 15:39:27 -0500 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 5AE373FAF; Thu, 16 Feb 2006 15:39:23 -0500 (EST) Date: Thu, 16 Feb 2006 15:39:23 -0500 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Using EXPLAIN-ANALYZE Message-ID: <20060216203923.GA9872@phlogiston.dyndns.org> References: <18AE59788A3FC640A367E5652E664D80019287F0@xmb-sjc-237.amer.cisco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18AE59788A3FC640A367E5652E664D80019287F0@xmb-sjc-237.amer.cisco.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200602/210 X-Sequence-Number: 24220 On Thu, Feb 16, 2006 at 12:07:10PM -0800, Kashmira Patel (kupatel) wrote: > Hi all, > I am pretty new to using Postrgres, and have been looking at the > messages in this forum for a while. I have noticed that the use of > EXPLAIN-ANALYZE is recommended quite a lot. I read the Postgres docs, > but am not quite sure I understand how this works. Is there some > tutorial or any other documentation how this can be used? Well, here's the short version: EXPLAIN [query] tells you what the planner _thinks_ it should do. EXPLAIN ANALYZE [query] tells you what the planner thinks it should do, and also executes the query and reports back how long every step took, how many rows were returned, &c. (For this reason, you want to wrap it in BEGIN;...;ROLLBACK; if it changes data.) For more, see the EXPLAIN EXPLAINED tutorial on techdocs.postgresql.org () A -- Andrew Sullivan | ajs@crankycanuck.ca In the future this spectacle of the middle classes shocking the avant- garde will probably become the textbook definition of Postmodernism. --Brad Holland