June 27th, 2024:
PostgreSQL 17 Beta 2 Released!

`pg_stats_ext_exprs`

The view `pg_stats_ext_exprs`

provides access to information about all expressions included in extended statistics objects, combining information stored in the `pg_statistic_ext`

and `pg_statistic_ext_data`

catalogs. This view allows access only to rows of `pg_statistic_ext`

and `pg_statistic_ext_data`

that correspond to tables the user owns, and therefore it is safe to allow public read access to this view.

`pg_stats_ext_exprs`

is also designed to present the information in a more readable format than the underlying catalogs — at the cost that its schema must be extended whenever the structure of statistics in `pg_statistic_ext`

changes.

**Table 52.92. pg_stats_ext_exprs Columns**

Column Type Description |
---|

Name of schema containing table |

Name of table the statistics object is defined on |

Name of schema containing extended statistics object |

Name of extended statistics object |

Owner of the extended statistics object |

Expression included in the extended statistics object |

Fraction of expression entries that are null |

Average width in bytes of expression's entries |

If greater than zero, the estimated number of distinct values in the expression. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when |

A list of the most common values in the expression. (Null if no values seem to be more common than any others.) |

A list of the frequencies of the most common values, i.e., number of occurrences of each divided by total number of rows. (Null when |

A list of values that divide the expression's values into groups of approximately equal population. The values in |

Statistical correlation between physical row ordering and logical ordering of the expression values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the expression will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This expression is null if the expression's data type does not have a |

A list of non-null element values most often appearing within values of the expression. (Null for scalar types.) |

A list of the frequencies of the most common element values, i.e., the fraction of rows containing at least one instance of the given value. Two or three additional values follow the per-element frequencies; these are the minimum and maximum of the preceding per-element frequencies, and optionally the frequency of null elements. (Null when |

A histogram of the counts of distinct non-null element values within the values of the expression, followed by the average number of distinct non-null elements. (Null for scalar types.) |

The maximum number of entries in the array fields can be controlled on a column-by-column basis using the `ALTER TABLE SET STATISTICS`

command, or globally by setting the default_statistics_target run-time parameter.

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.