ALTER INDEX .. SET STATISTICS ... behaviour

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: ALTER INDEX .. SET STATISTICS ... behaviour
Date: 2017-05-31 15:36:50
Message-ID: CAPpHfdsSYo6xpt0F=ngAdqMPFJJhC7zApde9h1qwkdpHpwFisA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

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

1.
https://www.postgresql.org/message-id/flat/20150716143149.GO2301%40postgresql.org

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-05-31 15:53:49 Re: ALTER INDEX .. SET STATISTICS ... behaviour
Previous Message Tom Lane 2017-05-31 15:36:18 Re: [PATCH] quiet conversion warning in DatumGetFloat4