Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id DBE73635304 for ; Mon, 30 Mar 2009 09:06:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 75767-01-10 for ; Mon, 30 Mar 2009 09:06:06 -0300 (ADT) X-Greylist: delayed 00:15:29.329706 by SQLgrey-1.7.6 Received: from mail-fx0-f174.google.com (mail-fx0-f174.google.com [209.85.220.174]) by mail.postgresql.org (Postfix) with ESMTP id CC8A664059A for ; Mon, 30 Mar 2009 08:47:22 -0300 (ADT) Received: by fxm22 with SMTP id 22so3389773fxm.19 for ; Mon, 30 Mar 2009 04:47:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <603c8f070902281932w257853e2me25cf567da6a3c46@mail.gmail.com> References: <88daf38c0902141425s6972d849i9dad904f55d93c77@mail.gmail.com> <88daf38c0902150845y2878fcbfmcd06d426b53a886a@mail.gmail.com> <88daf38c0902271218p1931ec9dyfdc269bceab24190@mail.gmail.com> <603c8f070902271454h5a78a063kcf2b78a10fd956b1@mail.gmail.com> <88daf38c0902280820p745ea234s85efa7f5e58bd0ed@mail.gmail.com> <603c8f070902281932w257853e2me25cf567da6a3c46@mail.gmail.com> Date: Mon, 30 Mar 2009 12:24:55 +0100 Received: by 10.103.131.18 with SMTP id i18mr1650259mun.74.1238412311801; Mon, 30 Mar 2009 04:25:11 -0700 (PDT) Message-ID: <88daf38c0903300424s365ef753t52e3d0373131a40d@mail.gmail.com> Subject: Re: Bad plan for nested loop + limit From: Alexander Staubo To: Robert Haas Cc: pgsql-performance Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: 200903/405 X-Sequence-Number: 33327 On Sun, Mar 1, 2009 at 4:32 AM, Robert Haas wrote: > What do you have default_statistics_target set to? =C2=A0If it's less tha= n > 100, you should probably raise it to 100 and re-analyze (the default > value for 8.4 will be 100, but for 8.3 and prior it is 10). Changing it to 100 fixed the problem. Thanks for alerting me to the existence of default_statistics_target. Alexander.