Re: Fix to not check included columns in ANALYZE on indexes - Mailing list pgsql-hackers

From Yugo Nagata
Subject Re: Fix to not check included columns in ANALYZE on indexes
Date
Msg-id 20180629173101.2b126621.nagata@sraoss.co.jp
Whole thread Raw
In response to Re: Fix to not check included columns in ANALYZE on indexes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fix to not check included columns in ANALYZE on indexes
List pgsql-hackers
On Thu, 28 Jun 2018 19:18:36 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Yugo Nagata <nagata@sraoss.co.jp> writes:
> > I found that both key columns and included columns are checked when analyze 
> > is run on indexes. This is almost harmless because non-expression columns
> > are not processed. However, this check is obviously unnecessary and we
> > can fix this to not check included columns. If we decide to support expressions
> > in included columns in future, this must be fixed eventually.
> 
> AFAICS, we'd just have to revert this patch later, so I don't see
> much value in it.

I'm sorry but I don't understand why we'd just have to revert this patch later.

Do you mean that if we decide to support expressions in included columns in future,
this patch would be reverted? This is wrong. To my understanding, statistics on
included  (= non-key) columns in index is never used by the planner whether this
is expression or not. So, we don't have to examin these columns in ANALYZE.

> Also, is it really true that we don't support included expression
> columns now?  In what way would that not be a bug?

Currently, included expression columns are not supported.

 postgres=# create index on test(i) include ((d+1));
 ERROR:  expressions are not supported in included columns

> 
>             regards, tom lane
> 


-- 
Yugo Nagata <nagata@sraoss.co.jp>


pgsql-hackers by date:

Previous
From: Sergei Kornilov
Date:
Subject: Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query
Next
From: Kyotaro HORIGUCHI
Date:
Subject: shared-memory based stats collector