X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3635BD1B441 for ; Thu, 18 Dec 2003 10:30:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 91047-06 for ; Thu, 18 Dec 2003 06:30:28 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 3C296D1B499 for ; Thu, 18 Dec 2003 06:30:26 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hBIAUPU6013702 for ; Thu, 18 Dec 2003 10:30:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hBIAFCZu089885 for pgsql-admin@postgresql.org; Thu, 18 Dec 2003 10:15:12 GMT From: CoL X-Newsgroups: comp.databases.postgresql.admin Subject: Re: PostgreSQL: query optimizer: viewing query plans Date: Thu, 18 Dec 2003 11:15:44 +0100 Organization: Hub.Org Networking Services Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en In-Reply-To: To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/272 X-Sequence-Number: 11778 Hi, Neil Zanella wrote: > Hello, > > Several textbooks talk about query trees and query plans including the following > relatively recent book which covers > how to apply performance tuning techniques by using knowledge about the query > optimizer to rewrite SQL queries so that they get interpreted more efficiently. > > Unfortunately the book only shows how to view the query plan associated witht the > given query for Oracle, IBM DB2, and MS SQL Server. I wonder whether PostgreSQL > also has a way to let the user see the heuristically computed query plan created > by the query optimizer. Is it possible to view query plans with PostgreSQL server > and its related command line interfaces? How would I run such a command? explain query explain analyze query and you can set logging in postgres.conf, and you can log debug_print_XXX things (xxx like parse, rewritten query, the plan) C.