X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 281C852CDC for ; Mon, 18 Jul 2005 16:24:26 -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 33161-08 for ; Mon, 18 Jul 2005 19:24:24 +0000 (GMT) Received: from netbox.unitech.com.ar (unknown [200.32.92.34]) by svr1.postgresql.org (Postfix) with ESMTP id C37DD52CD7 for ; Mon, 18 Jul 2005 16:24:21 -0300 (ADT) Received: from dariop (dariop.unitech.com.ar [192.168.1.237]) by netbox.unitech.com.ar (8.11.6/8.11.6) with ESMTP id j6IKOhE17938 for ; Mon, 18 Jul 2005 16:24:43 -0400 Received: from 127.0.0.1 (AVG SMTP 7.0.323 [267.9.0]); Mon, 18 Jul 2005 16:24:19 -0300 From: "Dario" To: Subject: Re: join and query planner Date: Mon, 18 Jul 2005 16:24:19 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.104 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/268 X-Sequence-Number: 13509 Hi. > Just out of curiosity, does it do any better with the following? > > SELECT ... Yes, it does. But my query could also be SELECT ... FROM a JOIN b ON (a.key = b.key) LEFT JOIN c ON (c.key = a.key) LEFT JOIN d ON (d.key=a.key) /*new*/ , e WHERE (b.column <= 100) /*new*/ and (e.key = a.key) and (e.field = 'filter') because it's constructed by an application. I needed to know if, somehow, someway, I can "unforce" join order. The only way to solve it so far is changing application. It must build something like SELECT ... FROM b JOIN (a JOIN e ON (e.key = a.key)) ON (a.key = b.key) LEFT JOIN c ON (c.key = a.key) LEFT JOIN d ON (d.key=a.key) WHERE (b.column <= 100) and (e.field = 'filter') Supossed that e.field has (should have) better selectivity. But now this problem belongs to programmer's group :-) The query, in fact, has more tables to join. I wonder if lowering geqo threshold could do the work... Thank you. Greetings. Long life, little spam and prosperity! -----Mensaje original----- De: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]En nombre de Kevin Grittner Enviado el: lunes, 18 de julio de 2005 14:58 Para: pgsql-performance@postgresql.org; dariop@unitech.com.ar Asunto: Re: [PERFORM] join and query planner Just out of curiosity, does it do any better with the following? SELECT ... FROM a JOIN b ON (a.key = b.key) LEFT JOIN c ON (c.key = a.key) LEFT JOIN d ON (d.key=a.key) WHERE (b.column <= 100) >>> snipp