Re: [HACKERS] ALTER INDEX .. SET STATISTICS ... behaviour

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Re: [HACKERS] ALTER INDEX .. SET STATISTICS ... behaviour
Дата
Msg-id CAPpHfduoczxADNiGM7FMnZsVoNsP5+9KOMtcozs1bHzY71barw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] ALTER INDEX .. SET STATISTICS ... behaviour  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Ответы Re: [HACKERS] ALTER INDEX .. SET STATISTICS ... behaviour  (Amit Kapila <amit.kapila16@gmail.com>)
Re: [HACKERS] ALTER INDEX .. SET STATISTICS ... behaviour  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Список pgsql-hackers
On Wed, May 31, 2017 at 7:18 PM, Alexander Korotkov <a.korotkov@postgrespro.ru> wrote:
On Wed, May 31, 2017 at 6:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Alexander Korotkov <a.korotkov@postgrespro.ru> writes:
> I've discovered that PostgreSQL is able to run following kind of queries in
> order to change statistic-gathering target for an indexed expression.

> ALTER INDEX index_name ALTER COLUMN expr SET STATISTICS stat_target;

> It's been previously discussed in [1].

> I think this should be fixed not just in docs.  This is why I've started
> thread in pgsql-hackers.  For me usage of internal column names "expr",
> "expr1", "expr2" etc. looks weird.  And I think we should replace it with a
> better syntax.  What do you think about these options?

> ALTER INDEX index_name ALTER EXPRESSION 0 SET STATISTICS stat_target; --
> Refer expression by its number
> ALTER INDEX index_name ALTER EXPRESSION (x + y) SET STATISTICS stat_target;
> -- Refer expression by its definition

Don't like either of those particularly, but what about just targeting
a column by column number, independently of whether it's an expression?

        ALTER INDEX myindex ALTER COLUMN 4 SET STATISTICS 1000;

I completely agree with that.
If no objections, I will write a patch for that.

Please, find it in attached patch.

I decided to forbid referencing columns by numbers for tables, because those numbers could contain gaps.  Also, I forbid altering statistics target for non-expression index columns, because it has no effect.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Вложения

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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: [HACKERS] Create subscription with `create_slot=false` andincorrect slot name
Следующее
От: Rafia Sabih
Дата:
Сообщение: Re: [HACKERS] Effect of changing the value for PARALLEL_TUPLE_QUEUE_SIZE