Re: Expression index ignores column statistics target

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Expression index ignores column statistics target
Дата
Msg-id 5335.1128142383@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Expression index ignores column statistics target  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Expression index ignores column statistics target  (Michael Fuhr <mike@fuhr.org>)
Re: Expression index ignores column statistics target  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Expression index ignores column statistics target  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Michael Fuhr <mike@fuhr.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.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Expression index ignores column statistics target
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Expression index ignores column statistics target