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 6F9E9537F0 for ; Tue, 29 Mar 2005 18:32:06 +0100 (BST) 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 26957-08 for ; Tue, 29 Mar 2005 17:31:59 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 36F715372F for ; Tue, 29 Mar 2005 18:31:58 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2THVnOW003341; Tue, 29 Mar 2005 12:31:49 -0500 (EST) To: Simon Riggs Cc: Karim A Nassar , Stephan Szabo , Christopher Kings-Lynne , pgsql-performance@postgresql.org Subject: Re: Delete query takes exorbitant amount of time In-reply-to: <1112116665.11750.1017.camel@localhost.localdomain> References: <1112095776.11750.958.camel@localhost.localdomain> <21461.1112107257@sss.pgh.pa.us> <1112116665.11750.1017.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Tue, 29 Mar 2005 18:17:45 +0100" Date: Tue, 29 Mar 2005 12:31:49 -0500 Message-ID: <3340.1112117509@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/640 X-Sequence-Number: 11345 Simon Riggs writes: > That implies to me that LIMIT queries are not considered correctly in > the M&L formula and thus we are more likely to calculate a too-high cost > for using an index in those circumstances....and thus more likely to > SeqScan for medium sized relations? You misunderstand how LIMIT is handled. The plan structure is LIMIT ... regular plan ... and so the strategy is to plan and cost the regular plan as though it would be carried out in full, and then take an appropriate fraction of that at the LIMIT stage. regards, tom lane