X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id DB2829FA279 for ; Wed, 17 May 2006 15:58:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 88711-04 for ; Wed, 17 May 2006 15:58:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net [70.167.125.69]) by postgresql.org (Postfix) with ESMTP id 29D5D9F944D for ; Wed, 17 May 2006 15:58:22 -0300 (ADT) Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id k4HJ70b3021707; Wed, 17 May 2006 12:07:00 -0700 Message-ID: <446B7241.2060409@modgraph-usa.com> Date: Wed, 17 May 2006 11:58:09 -0700 From: "Craig A. James" User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: Bruno Wolff III , pgsql-performance@postgresql.org Subject: Re: Optimizer: limit not taken into account References: <44699C6C.80302@tweakers.net> <4469D173.50406@sun.com> <4469D986.6090300@tweakers.net> <4469F55A.7040004@sun.com> <446A1520.2020601@tweakers.net> <446B0409.7050902@sun.com> <446B0ED2.5030909@tweakers.net> <446B474C.2050803@modgraph-usa.com> <20060517174426.GA14567@wolff.to> <24245.1147890622@sss.pgh.pa.us> In-Reply-To: <24245.1147890622@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/369 X-Sequence-Number: 19156 Tom Lane wrote: > There is not anything in there that considers whether the table's > physical order is so nonrandom that the search will take much longer > than it would given uniform distribution. It might be possible to do > something with the correlation statistic in simple cases ... In this case, the rows are not random at all, in fact they're inserted from a sequence, then rows are deleted as they are processed. If the planner is hoping for random physical distribution, this particular case is exactly wrong. Craig