X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C3FA952BF4 for ; Fri, 12 Aug 2005 13:35:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79944-06 for ; Fri, 12 Aug 2005 16:35:13 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id CC35452968 for ; Fri, 12 Aug 2005 13:35:12 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id F048C41809D; Fri, 12 Aug 2005 17:34:59 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id F039215EDA; Fri, 12 Aug 2005 17:28:41 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20195-02; Fri, 12 Aug 2005 17:28:38 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3CEE315ED9; Fri, 12 Aug 2005 17:28:38 +0100 (BST) Message-ID: <42FCCE35.1010104@archonet.com> Date: Fri, 12 Aug 2005 17:28:37 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: marcelo Cortez Cc: pgsql-general@postgresql.org Subject: Re: query optimization References: <20050812161158.93055.qmail@web32615.mail.mud.yahoo.com> In-Reply-To: <20050812161158.93055.qmail@web32615.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=[AWL=0.007, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200508/666 X-Sequence-Number: 82074 marcelo Cortez wrote: > hi guys > > i need advice for query optimization,take too long > time. > any coments are welcomed :). Comment 1 - you'll need to post the output of "EXPLAIN ANALYSE", not just EXPLAIN, otherwise people can't see how long it took. Comment 2 - you provide the definition of one table but there are about 20 involved in the query. Comment 3 - likewise for the size of tables. Comment 4 - you apply a LIMIT without an ORDER BY. Are you sure this is what you want? Comment 5 - you don't show any INDEX definitions, so it's difficult to know whether they are being used. Comment 6 - Do you know about the genetic query optimiser and thq geqo_xxx configuration settings? HTH - come back with the EXPLAIN ANALYSE etc. -- Richard Huxton Archonet Ltd