Hi,

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.

Attached is a patch to fix this.

Regards,

-- 
Yugo Nagata <nag...@sraoss.co.jp>
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 25194e8..d2b2c39 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -493,7 +493,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params,
 				thisdata->vacattrstats = (VacAttrStats **)
 					palloc(indexInfo->ii_NumIndexAttrs * sizeof(VacAttrStats *));
 				tcnt = 0;
-				for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
+				for (i = 0; i < indexInfo->ii_NumIndexKeyAttrs; i++)
 				{
 					int			keycol = indexInfo->ii_IndexAttrNumbers[i];
 

Reply via email to