Re: Expression index ignores column statistics target

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Expression index ignores column statistics target
Date: 2005-10-01 14:34:57
Message-ID: 200510011434.j91EYvm17609@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > I've noticed that row count estimates for expression indexes appear
> > to rely on default_statistics_target rather than on a column's
> > actual statistics target. That is, if I use ALTER TABLE SET
> > STATISTICS to increase a column's statistics target and then run
> > ANALYZE, then estimates for non-expression-index queries improve
> > as expected. However, queries that use an expression index remain
> > accurate for only around the N most common values, where N is the
> > default_statistics_target that was in effect when ANALYZE ran.
>
> The code does in fact honor per-column statistics targets attached to
> expression indexes, viz
>
> alter table myfuncindex alter column pg_expression_1 set statistics 100;
>
> This isn't documented, mainly because pg_dump doesn't promise to dump
> such things, which it doesn't do because I didn't want to see the
> "pg_expression_N" naming for expression index columns become graven on
> stone tablets. I seem to recall bringing up the question of whether
> we could find a less implementation-specific way of commanding this
> behavior, but I can't find it in the archives right now.

Is this a TODO?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-10-01 14:35:49 Re: effective SELECT from child tables
Previous Message Ron Peacetree 2005-10-01 14:22:40 Re: [HACKERS] A Better External Sort?