Re: PG planning randomly ?

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Laurent Raufaste" <analogue(at)glop(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: PG planning randomly ?
Date: 2008-02-26 20:06:24
Message-ID: dcc563d10802261206i641a68f1w8719d42233dd489a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Feb 26, 2008 at 11:12 AM, Laurent Raufaste <analogue(at)glop(dot)org> wrote:
> 2008/2/26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> >
> > 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;

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Peter Koczan 2008-02-26 20:46:04 disabling an index without deleting it?
Previous Message Laurent Raufaste 2008-02-26 20:05:24 Re: PG planning randomly ?