X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C7B37DAE84 for ; Tue, 25 Oct 2005 20:56: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 79143-07 for ; Tue, 25 Oct 2005 23:56:11 +0000 (GMT) Received: from web54301.mail.yahoo.com (web54301.mail.yahoo.com [206.190.49.111]) by svr1.postgresql.org (Postfix) with SMTP id B61E8DAE7D for ; Tue, 25 Oct 2005 20:56:12 -0300 (ADT) Received: (qmail 20769 invoked by uid 60001); 25 Oct 2005 23:56:12 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=LJ7gUNUBm6etmYgCAPgmEbES9E3lppYZK9w9miouG87H6aeyAJNJsVjCeopGKcKlvED6/JQqDKGPXXpXF6JwSltldXzet19zK8YOd8p5fyYkwTAfQll7rq5GY1UlmyKlIkl9j/6nNpdVLUHX/8z+gQCvRJYf9IV5dzWtpu5BxSs= ; Message-ID: <20051025235612.20767.qmail@web54301.mail.yahoo.com> Received: from [69.241.169.206] by web54301.mail.yahoo.com via HTTP; Tue, 25 Oct 2005 16:56:11 PDT Date: Tue, 25 Oct 2005 16:56:11 -0700 (PDT) From: chester c young Subject: broken join optimization? (8.0) To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.374 required=5 tests=[DNS_FROM_RFC_ABUSE=0.374] X-Spam-Level: X-Archive-Number: 200510/296 X-Sequence-Number: 23149 in php (for example) it's frequently nice to get the structure of a table without any data, ie, pull a single row with each attribute's value is null. I use the query (dual is a table of one row ala Oracle): select m.* from dual left join mytable m on( false ); this works every time, but if mytable is big, then takes a long time. needed to rewrite the query to: select m.* from dual left join (select * from mytable limit 1) m on( false ); this works as it should - pulls empty row but fast. it seems to me that a full table scan should not be necessary if the join condition is false. __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs