Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B3FA964FF6F for ; Tue, 26 Aug 2008 15:42:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 79297-05 for ; Tue, 26 Aug 2008 15:41:50 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by postgresql.org (Postfix) with ESMTP id CF1CB64FD1D for ; Tue, 26 Aug 2008 15:41:51 -0300 (ADT) Received: by gxk10 with SMTP id 10so3561438gxk.19 for ; Tue, 26 Aug 2008 11:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=R9emGYMHTlvYGytzohKNSVT+EzmOVnpt/6MNJ6Bkz0w=; b=mbdiBP1+cy41SACdclggt9z+ubrW2h/VzMnneLBsfDXgBkYQ9QPq+ZVjoLVtZyJtp0 CHs7cNYPSS8NDzhpH0LrcZOrZlneH+TkvD4hyNhNw2AkZPI7Koh7lr8pGFezScEzyPD4 kI+NsB6Yo4Ap7EpiLwsqicKWVLk4pROIkJO1A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=MpdL6KI9Sy/eF0WUw9T67Psw1gq4tdWonMmLtWR9ZW2SJ6WmV5i2MbCspTnF2Cxsaq 7zhUbeNfaUSoYwnG7EScRS42lRBBcijTTyLZV1J2Tj/wEekEOAwpXbTaoCA5MYeq8nVg RmiQsqmUgv1xRlMoRTHKIVx5cR9WMHaKt0Bmk= Received: by 10.151.109.11 with SMTP id l11mr9660317ybm.204.1219776109980; Tue, 26 Aug 2008 11:41:49 -0700 (PDT) Received: by 10.151.45.8 with HTTP; Tue, 26 Aug 2008 11:41:49 -0700 (PDT) Message-ID: <7d10d2df0808261141k4ca6800dm5c847098af8da51d@mail.gmail.com> Date: Tue, 26 Aug 2008 19:41:49 +0100 From: "Frank Joerdens" To: "Tom Lane" Subject: Re: Query w empty result set with LIMIT orders of magnitude slower than without Cc: pgsql-performance@postgresql.org, Nic , "Seb Potter" In-Reply-To: <10025.1219769589@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7d10d2df0808260937v3103e216h764bbb74ca597d6f@mail.gmail.com> <10025.1219769589@sss.pgh.pa.us> X-Google-Sender-Auth: 8cddb98864e1e6ae 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: 200808/339 X-Sequence-Number: 31220 On Tue, Aug 26, 2008 at 5:53 PM, Tom Lane wrote: > "Frank Joerdens" writes: >> It seems to me that the planner makes a very poor decision with this >> particular query: > > Try increasing the stats on woouser. You need it to make a smaller > estimate of the number of matching rows here: Way cool, this alter table webapp_invite alter column woouser set statistics 50; did the trick, without cleaning up the spurious join there even. Thanks! Frank