aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/array.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-03-03 20:20:19 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-03-03 20:20:57 -0500
commit0e5e167aaea4ceb355a6e20eec96c4f7d05527ab (patch)
tree1b1b338461cba27a2d783db13b74d1b7b86b6681 /src/include/utils/array.h
parent34c978442c55dd13a3a8c6b90fd4380dad02f3da (diff)
downloadpostgresql-0e5e167aaea4ceb355a6e20eec96c4f7d05527ab.tar.gz
postgresql-0e5e167aaea4ceb355a6e20eec96c4f7d05527ab.zip
Collect and use element-frequency statistics for arrays.
This patch improves selectivity estimation for the array <@, &&, and @> (containment and overlaps) operators. It enables collection of statistics about individual array element values by ANALYZE, and introduces operator-specific estimators that use these stats. In addition, ScalarArrayOpExpr constructs of the forms "const = ANY/ALL (array_column)" and "const <> ANY/ALL (array_column)" are estimated by treating them as variants of the containment operators. Since we still collect scalar-style stats about the array values as a whole, the pg_stats view is expanded to show both these stats and the array-style stats in separate columns. This creates an incompatible change in how stats for tsvector columns are displayed in pg_stats: the stats about lexemes are now displayed in the array-related columns instead of the original scalar-related columns. There are a few loose ends here, notably that it'd be nice to be able to suppress either the scalar-style stats or the array-element stats for columns for which they're not useful. But the patch is in good enough shape to commit for wider testing. Alexander Korotkov, reviewed by Noah Misch and Nathan Boley
Diffstat (limited to 'src/include/utils/array.h')
-rw-r--r--src/include/utils/array.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index c6d0ad67f88..1da20fefdab 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -289,4 +289,9 @@ extern ArrayType *create_singleton_array(FunctionCallInfo fcinfo,
extern Datum array_agg_transfn(PG_FUNCTION_ARGS);
extern Datum array_agg_finalfn(PG_FUNCTION_ARGS);
+/*
+ * prototypes for functions defined in array_typanalyze.c
+ */
+extern Datum array_typanalyze(PG_FUNCTION_ARGS);
+
#endif /* ARRAY_H */