Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 570CB2E008F for ; Sun, 25 May 2008 05:29:11 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94059-08 for ; Sun, 25 May 2008 05:29:03 -0300 (ADT) X-Greylist: delayed 00:07:29.941962 by SQLgrey-1.7.6 Received: from aristoteles.cuci.nl (aristoteles.cuci.nl [212.125.128.18]) by developer.postgresql.org (Postfix) with ESMTP id 6C3072E0049 for ; Sun, 25 May 2008 05:29:05 -0300 (ADT) Received: by aristoteles.cuci.nl (Postfix, from userid 500) id 9C41D5461; Sun, 25 May 2008 10:21:33 +0200 (CEST) Date: Sun, 25 May 2008 10:21:33 +0200 From: "Stephen R. van den Berg" To: Decibel! Cc: Richard Huxton , PG Hackers , Luke Lonergan , albert@sedifa.com Subject: Re: [PERFORM] Posible planner improvement? Message-ID: <20080525082133.GB27965@cuci.nl> References: <014F2941B0A1EA47BD61D21526B806E90162C3D2@MI8NYCMAIL08.Mi8.com> <48341F1D.3090304@archonet.com> <1870DB98-E4E2-4DB5-8620-DB4A8309A73C@decibel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1870DB98-E4E2-4DB5-8620-DB4A8309A73C@decibel.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200805/738 X-Sequence-Number: 118737 Decibel! wrote: >For reference, the original query as posted to -performance: >select * from t1, t2 where t1.id > 158507 and t1.id = t2.id; >That took > 84 minutes (the query was a bit longer but this is the >part that made the difference) after a little change the query took >~1 second: Just out of curiosity, would predefining the order of join have solved the issue, as in: a. select * from t1 join t2 using(id) where t1.id > 158507; vs. b. select * from t2 join t1 using(id) where t1.id > 158507; I'd expect a to be faster than b, is it? -- Sincerely, srb@cuci.nl Stephen R. van den Berg. "Technology is stuff that doesn't work yet." -- Bran Ferren "We no longer think of chairs as technology." -- Douglas Adams