Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 189A32E0030 for ; Tue, 26 Feb 2008 17:59:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 54022-06 for ; Tue, 26 Feb 2008 17:59:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EF0122E003D for ; Tue, 26 Feb 2008 17:59:41 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m1QLxXjJ008662; Tue, 26 Feb 2008 16:59:33 -0500 (EST) To: "Scott Marlowe" cc: "Laurent Raufaste" , pgsql-performance@postgresql.org Subject: Re: PG planning randomly ? In-reply-to: References: <669dc9710802260719h61d846b3hd50b7f547bcb82c3@mail.gmail.com> <3637.1204043502@sss.pgh.pa.us> <669dc9710802260912y7fe58f9epe42fe7eb360119d8@mail.gmail.com> Comments: In-reply-to "Scott Marlowe" message dated "Tue, 26 Feb 2008 14:06:24 -0600" Date: Tue, 26 Feb 2008 16:59:33 -0500 Message-ID: <8661.1204063173@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/354 X-Sequence-Number: 28896 "Scott Marlowe" writes: > On Tue, Feb 26, 2008 at 11:12 AM, Laurent Raufaste wrote: >> 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. > 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; That's completely incorrect. If the column doesn't have a specific stats target (indicated by -1 in attstattarget, which Laurent showed us was the case), then ANALYZE will use the current value of default_statistics_target. The table-creation-time value of that parameter isn't relevant at all. regards, tom lane