Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EEC242E00FD for ; Tue, 26 Feb 2008 16:08:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 47522-01-5 for ; Tue, 26 Feb 2008 16:08:04 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by postgresql.org (Postfix) with ESMTP id 8C44A2E00BA for ; Tue, 26 Feb 2008 16:06:25 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so2661720waf.5 for ; Tue, 26 Feb 2008 12:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=BhK7QBNt7On/z3SJ95EouiEJDhKOYvwQYO001j9LzBI=; b=tcQUx8+pi0NG3/CQttcMP2i8u9fTC4BLva4FM3fu9fQ6X1oZm/XCTfkqkXYhkw8ITTmPCgcM9KpM/24BtpGw406q7Eua7SG/t3+7sWiJE6rYG7eQNicoW0PgEYJIgtROgFYrrea3B76JsRU195jqB0zIjqkOG88t5NqV+AB4e6k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RshJRgBqJv4j6y3sB0iB7SWswf7WEWlOSchzmwnkUPNtOo2CrZuWv2CxHC39RXdprgQ/bz6qEPdW/wq9VQ8qEhAU7HW/M9yUUSy9NXcwLu6iUb6VPbqTMY2Traog57smmX5EFcfh46jNW5EoaE6KTAB+bLbQIugei3uUT4CVamA= Received: by 10.114.59.1 with SMTP id h1mr6081531waa.39.1204056384092; Tue, 26 Feb 2008 12:06:24 -0800 (PST) Received: by 10.114.133.6 with HTTP; Tue, 26 Feb 2008 12:06:24 -0800 (PST) Message-ID: Date: Tue, 26 Feb 2008 14:06:24 -0600 From: "Scott Marlowe" To: "Laurent Raufaste" Subject: Re: PG planning randomly ? Cc: "Tom Lane" , pgsql-performance@postgresql.org In-Reply-To: <669dc9710802260912y7fe58f9epe42fe7eb360119d8@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <669dc9710802260719h61d846b3hd50b7f547bcb82c3@mail.gmail.com> <3637.1204043502@sss.pgh.pa.us> <669dc9710802260912y7fe58f9epe42fe7eb360119d8@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/349 X-Sequence-Number: 28891 On Tue, Feb 26, 2008 at 11:12 AM, Laurent Raufaste wrote: > 2008/2/26, Tom Lane : > > > > > What PG version is this? > > > > If it's 8.2 or later then increasing the stats target for _comment.path > > to 100 or more would likely help. > > > > I'm using PG 8.2.4. > We are using 100 as default_statistics_target by default and all our > column are using this value: > # SELECT attname,attstattarget FROM pg_attribute WHERE attrelid=16743 > AND attname='path' ; > attname | attstattarget > ---------+--------------- > path | -1 > > I tried increasing the stats target with the command: > SET default_statistics_target=1000 ; > That's the command I launched before executing the ANALYZE showed in > the previous mail. > The ANALYZE were longer to complete, but it did not change the planner > behavior (sometimes right, sometimes wrong). You're doing it wrong. The default target affects newly created columns / tables. You need to use alter table to change a stats target after creation. Like so: alter table abc alter column xyz set statistics 100;