{"Entry":{"collection":"catalog","key":"pg_stats","name":"pg_stats","aliases":[],"metadata":{"changed_in":["9.0","9.2","17","19"],"changes":[{"added":[],"attributes":[],"description_changed":true,"descriptions":[],"from":"7.4","listing":[],"order":false,"removed":[],"status":"reworded","to":"8.0","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"name of the column described by this row","name":"attname","to":"Name of the column described by this row"},{"from":"average width in bytes of column's entries","name":"avg_width","to":"Average width in bytes of column's entries"},{"from":"If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows.","name":"n_distinct","to":"If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows"},{"from":"fraction of column entries that are null","name":"null_frac","to":"Fraction of column entries that are null"},{"from":"name of schema containing table","name":"schemaname","to":"Name of schema containing table"},{"from":"name of table","name":"tablename","to":"Name of table"}],"from":"8.1","listing":[],"order":false,"removed":[],"status":"reworded","to":"8.2","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"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 most_common_vals is.)","name":"most_common_freqs","to":"A list of the frequencies of the most common values or elements, i.e., number of occurrences of each divided by total number of rows. (NULL when most_common_vals is.) For some datatypes such as tsvector, it can also store some additional information, making it longer than the most_common_vals array."},{"from":"A list of the most common values in the column. (NULL if no values seem to be more common than any others.)","name":"most_common_vals","to":"A list of the most common values in the column. (NULL if no values seem to be more common than any others.) For some datatypes such as tsvector, this is a list of the most common element values rather than values of the type itself."}],"from":"8.3","listing":[],"order":false,"removed":[],"status":"reworded","to":"8.4","types":[],"unlisted":[]},{"added":["inherited"],"attributes":[],"description_changed":false,"descriptions":[{"from":"Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is NULL if the column data type does not have a \u003c operator.)","name":"correlation","to":"Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is null if the column data type does not have a \u003c operator.)"},{"from":"A list of values that divide the column's values into groups of approximately equal population. The values in most_common_vals, if present, are omitted from this histogram calculation. (This column is NULL if the column data type does not have a \u003c operator or if the most_common_vals list accounts for the entire population.)","name":"histogram_bounds","to":"A list of values that divide the column's values into groups of approximately equal population. The values in most_common_vals, if present, are omitted from this histogram calculation. (This column is null if the column data type does not have a \u003c operator or if the most_common_vals list accounts for the entire population.)"},{"from":"A list of the frequencies of the most common values or elements, i.e., number of occurrences of each divided by total number of rows. (NULL when most_common_vals is.) For some datatypes such as tsvector, it can also store some additional information, making it longer than the most_common_vals array.","name":"most_common_freqs","to":"A list of the frequencies of the most common values or elements, i.e., number of occurrences of each divided by total number of rows. (Null when most_common_vals is.) For some data types such as tsvector, it can also store some additional information, making it longer than the most_common_vals array."},{"from":"A list of the most common values in the column. (NULL if no values seem to be more common than any others.) For some datatypes such as tsvector, this is a list of the most common element values rather than values of the type itself.","name":"most_common_vals","to":"A list of the most common values in the column. (Null if no values seem to be more common than any others.) For some data types such as tsvector, this is a list of the most common element values rather than values of the type itself."},{"from":"If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows","name":"n_distinct","to":"If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows."}],"from":"8.4","listing":[],"order":false,"removed":[],"status":"changed","to":"9.0","types":[],"unlisted":[]},{"added":["most_common_elems","most_common_elem_freqs","elem_count_histogram"],"attributes":[],"description_changed":false,"descriptions":[{"from":"A list of the frequencies of the most common values or elements, i.e., number of occurrences of each divided by total number of rows. (Null when most_common_vals is.) For some data types such as tsvector, it can also store some additional information, making it longer than the most_common_vals array.","name":"most_common_freqs","to":"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 most_common_vals is.)"},{"from":"A list of the most common values in the column. (Null if no values seem to be more common than any others.) For some data types such as tsvector, this is a list of the most common element values rather than values of the type itself.","name":"most_common_vals","to":"A list of the most common values in the column. (Null if no values seem to be more common than any others.)"}],"from":"9.1","listing":[],"order":false,"removed":[],"status":"changed","to":"9.2","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"Name of the column described by this row","name":"attname","to":"Name of column described by this row"}],"from":"13","listing":[],"order":false,"removed":[],"status":"reworded","to":"14","types":[],"unlisted":[]},{"added":[],"attributes":[],"description_changed":false,"descriptions":[{"from":"If true, this row includes inheritance child columns, not just the values in the specified table","name":"inherited","to":"If true, this row includes values from child tables, not just the values in the specified table"}],"from":"14","listing":[],"order":false,"removed":[],"status":"reworded","to":"15","types":[],"unlisted":[]},{"added":["range_length_histogram","range_empty_frac","range_bounds_histogram"],"attributes":[],"description_changed":false,"descriptions":[],"from":"16","listing":[],"order":false,"removed":[],"status":"changed","to":"17","types":[],"unlisted":[]},{"added":["tableid","attnum"],"attributes":[],"description_changed":false,"descriptions":[],"from":"18","listing":[],"order":false,"removed":[],"status":"changed","to":"19","types":[],"unlisted":[]}],"column_count":19,"content_hash":"6a0250f259dd52e7483bf93b35ebd679260a13c3fee32fd7809e46a066bfc0ba","first_version":"7.4","imported_at":"2026-09-30T00:40:56.192214+08:00","kind":"view","last_version":"20","name":"pg_stats","position":133,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"relation_oid":null,"relkind":"v","shared":false,"source_rev":"english-manuals:9e494107e6992dd2504e2967bba1837176eadd811fc8fd7b9df2d80efec96bbe","summary":"The view pg_stats provides access to the information stored in the pg_statistic catalog.","summary_zh":""}},"Definition":{"Collection":"catalog","Key":"pg_stats","SourceDatabase":"center","Version":"18","SourceTable":"catalog","SourceKey":"pg_stats","SourceRevision":"english-manuals:9e494107e6992dd2504e2967bba1837176eadd811fc8fd7b9df2d80efec96bbe","Facts":{"columns":[{"array_dimensions":0,"attnum":1,"description":"Name of schema containing table","description_zh":"","documented":true,"documented_name":"schemaname","hidden":false,"name":"schemaname","not_null":false,"references":"pg_namespace.nspname","type":"name","type_modifier":-1,"type_oid":19},{"array_dimensions":0,"attnum":2,"description":"Name of table","description_zh":"","documented":true,"documented_name":"tablename","hidden":false,"name":"tablename","not_null":false,"references":"pg_class.relname","type":"name","type_modifier":-1,"type_oid":19},{"array_dimensions":0,"attnum":3,"description":"Name of column described by this row","description_zh":"","documented":true,"documented_name":"attname","hidden":false,"name":"attname","not_null":false,"references":"pg_attribute.attname","type":"name","type_modifier":-1,"type_oid":19},{"array_dimensions":0,"attnum":4,"description":"If true, this row includes values from child tables, not just the values in the specified table","description_zh":"","documented":true,"documented_name":"inherited","hidden":false,"name":"inherited","not_null":false,"references":"","type":"bool","type_modifier":-1,"type_oid":16},{"array_dimensions":0,"attnum":5,"description":"Fraction of column entries that are null","description_zh":"","documented":true,"documented_name":"null_frac","hidden":false,"name":"null_frac","not_null":false,"references":"","type":"float4","type_modifier":-1,"type_oid":700},{"array_dimensions":0,"attnum":6,"description":"Average width in bytes of column's entries","description_zh":"","documented":true,"documented_name":"avg_width","hidden":false,"name":"avg_width","not_null":false,"references":"","type":"int4","type_modifier":-1,"type_oid":23},{"array_dimensions":0,"attnum":7,"description":"If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows.","description_zh":"","documented":true,"documented_name":"n_distinct","hidden":false,"name":"n_distinct","not_null":false,"references":"","type":"float4","type_modifier":-1,"type_oid":700},{"array_dimensions":0,"attnum":8,"description":"A list of the most common values in the column. (Null if no values seem to be more common than any others.)","description_zh":"","documented":true,"documented_name":"most_common_vals","hidden":false,"name":"most_common_vals","not_null":false,"references":"","type":"anyarray","type_modifier":-1,"type_oid":2277},{"array_dimensions":0,"attnum":9,"description":"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 most_common_vals is.)","description_zh":"","documented":true,"documented_name":"most_common_freqs","hidden":false,"name":"most_common_freqs","not_null":false,"references":"","type":"float4[]","type_modifier":-1,"type_oid":1021},{"array_dimensions":0,"attnum":10,"description":"A list of values that divide the column's values into groups of approximately equal population. The values in most_common_vals, if present, are omitted from this histogram calculation. (This column is null if the column data type does not have a \u003c operator or if the most_common_vals list accounts for the entire population.)","description_zh":"","documented":true,"documented_name":"histogram_bounds","hidden":false,"name":"histogram_bounds","not_null":false,"references":"","type":"anyarray","type_modifier":-1,"type_oid":2277},{"array_dimensions":0,"attnum":11,"description":"Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is null if the column data type does not have a \u003c operator.)","description_zh":"","documented":true,"documented_name":"correlation","hidden":false,"name":"correlation","not_null":false,"references":"","type":"float4","type_modifier":-1,"type_oid":700},{"array_dimensions":0,"attnum":12,"description":"A list of non-null element values most often appearing within values of the column. (Null for scalar types.)","description_zh":"","documented":true,"documented_name":"most_common_elems","hidden":false,"name":"most_common_elems","not_null":false,"references":"","type":"anyarray","type_modifier":-1,"type_oid":2277},{"array_dimensions":0,"attnum":13,"description":"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 most_common_elems is.)","description_zh":"","documented":true,"documented_name":"most_common_elem_freqs","hidden":false,"name":"most_common_elem_freqs","not_null":false,"references":"","type":"float4[]","type_modifier":-1,"type_oid":1021},{"array_dimensions":0,"attnum":14,"description":"A histogram of the counts of distinct non-null element values within the values of the column, followed by the average number of distinct non-null elements. (Null for scalar types.)","description_zh":"","documented":true,"documented_name":"elem_count_histogram","hidden":false,"name":"elem_count_histogram","not_null":false,"references":"","type":"float4[]","type_modifier":-1,"type_oid":1021},{"array_dimensions":0,"attnum":15,"description":"A histogram of the lengths of non-empty and non-null range values of a range type column. (Null for non-range types.)\n\nThis histogram is calculated using the subtype_diff range function regardless of whether range bounds are inclusive.","description_zh":"","documented":true,"documented_name":"range_length_histogram","hidden":false,"name":"range_length_histogram","not_null":false,"references":"","type":"anyarray","type_modifier":-1,"type_oid":2277},{"array_dimensions":0,"attnum":16,"description":"Fraction of column entries whose values are empty ranges. (Null for non-range types.)","description_zh":"","documented":true,"documented_name":"range_empty_frac","hidden":false,"name":"range_empty_frac","not_null":false,"references":"","type":"float4","type_modifier":-1,"type_oid":700},{"array_dimensions":0,"attnum":17,"description":"A histogram of lower and upper bounds of non-empty and non-null range values. (Null for non-range types.)\n\nThese two histograms are represented as a single array of ranges, whose lower bounds represent the histogram of lower bounds, and upper bounds represent the histogram of upper bounds.","description_zh":"","documented":true,"documented_name":"range_bounds_histogram","hidden":false,"name":"range_bounds_histogram","not_null":false,"references":"","type":"anyarray","type_modifier":-1,"type_oid":2277}],"description":"The view pg_stats provides access to the information stored in the pg_statistic catalog. This view allows access only to rows of pg_statistic that correspond to tables the user has permission to read, and therefore it is safe to allow public read access to this view.\n\npg_stats is also designed to present the information in a more readable format than the underlying catalog — at the cost that its schema must be extended whenever new slot types are defined for pg_statistic.","description_zh":"","doc":{"anchor":"id-1.10.5.33.5","file":"view-pg-stats.html","lang":"en","sha256":"b597ece3377072201aeaaf6d3de1ab6e99005824b379bd40aeea103cd2601fb3","slug":"18"},"kind":"view","lang":"en","measured_attributes":true,"metadata_release":"18.6","runtime_columns":["schemaname","tablename","attname","inherited","null_frac","avg_width","n_distinct","most_common_vals","most_common_freqs","histogram_bounds","correlation","most_common_elems","most_common_elem_freqs","elem_count_histogram","range_length_histogram","range_empty_frac","range_bounds_histogram"],"runtime_verified":false,"source":"english-manual"},"ManualEvidence":{"doc":{"anchor":"id-1.10.5.33.5","file":"view-pg-stats.html","lang":"en","sha256":"b597ece3377072201aeaaf6d3de1ab6e99005824b379bd40aeea103cd2601fb3","slug":"18"}},"MeasuredEvidence":{"measured_attributes":true,"metadata_release":"18.6","runtime_columns":["schemaname","tablename","attname","inherited","null_frac","avg_width","n_distinct","most_common_vals","most_common_freqs","histogram_bounds","correlation","most_common_elems","most_common_elem_freqs","elem_count_histogram","range_length_histogram","range_empty_frac","range_bounds_histogram"],"runtime_verified":false}},"Text":{"Collection":"catalog","Key":"pg_stats","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"pg_stats","Summary":"视图pg_stats提供对存储在pg_statistic目录中信息的访问。此视图仅允许访问用户具有读取权限的表对应的pg_statistic行，因此可以安全地允许对此视图进行公共读取访问。\n\npg_stats也旨在以比底层目录更易读的格式呈现信息— 但其模式必须在为pg_statistic定义新的槽类型时进行扩展。","BodyHTML":"\u003cp\u003e视图pg_stats提供对存储在pg_statistic目录中信息的访问。此视图仅允许访问用户具有读取权限的表对应的pg_statistic行，因此可以安全地允许对此视图进行公共读取访问。\n\npg_stats也旨在以比底层目录更易读的格式呈现信息— 但其模式必须在为pg_statistic定义新的槽类型时进行扩展。\u003c/p\u003e","SourceRevision":"2026-09-27@419045e","ContentHash":"4da9be31eac2824d4a171ad95d437b755a110244f26011a1ea8f5584141a8c6a","Payload":{"columns":[{"description_zh":"包含表的模式名称","name":"schemaname","type":"name","zh_from":"doc"},{"description_zh":"表的名称","name":"tablename","type":"name","zh_from":"doc"},{"description_zh":"被此行描述的列名","name":"attname","type":"name","zh_from":"doc"},{"description_zh":"如果为真，则此行包括来自子表的值，而不仅仅是指定表中的值","name":"inherited","type":"boolean","zh_from":"doc"},{"description_zh":"列项中为 NULL 的比例","name":"null_frac","type":"real","zh_from":"doc"},{"description_zh":"列的条目的平均字节宽度","name":"avg_width","type":"integer","zh_from":"doc"},{"description_zh":"如果大于零，表示列中不同值的估计个数。如果小于零，是不同值个数除以行数的负值（当ANALYZE认为不同值的数量会随着表增长而增加时采用负值的形式，而如果认为列具有固定数量的可能值时采用正值的形式）。例如，-1表示一个唯一列，即其中不同值的个数等于行数。","name":"n_distinct","type":"real","zh_from":"doc"},{"description_zh":"列中高频值的一个列表（如果没有任何一个值看起来比其他值更常用，此列为 NULL）","name":"most_common_vals","type":"anyarray","zh_from":"doc"},{"description_zh":"高频值的频率列表，即每一个高频值的出现次数除以总行数（如果most_common_vals为 NULL，则此列为 NULL）","name":"most_common_freqs","type":"real[]","zh_from":"doc"},{"description_zh":"用于将列值划分为若干组的值列表，各组所含值的数量近似相等。如果存在most_common_vals，其中的值会被直方图计算所忽略（如果列类型没有一个\u003c操作符或者most_common_vals列表覆盖了全部值，则此列为 NULL）","name":"histogram_bounds","type":"anyarray","zh_from":"doc"},{"description_zh":"物理行顺序和列值逻辑顺序之间的统计相关性。其范围从-1到+1。当值接近-1或+1时，在列上的一个索引扫描被估计为比值接近0时的代价更低，因为这种情况减少了对磁盘的随机访问（如果列数据类型不具有一个\u003c操作符，则此列为 NULL）","name":"correlation","type":"real","zh_from":"doc"},{"description_zh":"列值内最常出现的非 NULL 元素值的列表（对于标量类型为 NULL）。","name":"most_common_elems","type":"anyarray","zh_from":"doc"},{"description_zh":"高频元素值的频率列表，即至少包含一次给定值的行所占的比例。所有逐元素频率之后还有两个或三个附加值：前述逐元素频率的最小值和最大值，以及可选的 NULL 元素频率（当 most_common_elems 为 NULL 时，此列为 NULL）。","name":"most_common_elem_freqs","type":"real[]","zh_from":"doc"},{"description_zh":"各列值中不同非 NULL 元素的数量的直方图，后面跟随该数量的平均值（对于标量类型为 NULL）。","name":"elem_count_histogram","type":"real[]","zh_from":"doc"},{"description_zh":"范围类型列中非空且非 NULL 的范围值长度直方图。（非范围类型为 null。）\n\n该直方图使用范围函数 subtype_diff 计算，而不考虑范围边界是否包含端点。","name":"range_length_histogram","type":"anyarray","zh_from":"doc"},{"description_zh":"列项中值为空范围的比例。（非范围类型为 null。）","name":"range_empty_frac","type":"real","zh_from":"doc"},{"description_zh":"非空且非 NULL 的范围值的下界和上界直方图（对于非范围类型为 NULL）。\n\n这两个直方图表示为单个范围数组，其中各范围的下界表示下界直方图，上界表示上界直方图。","name":"range_bounds_histogram","type":"anyarray","zh_from":"doc"}],"description_zh":"视图pg_stats提供对存储在pg_statistic目录中信息的访问。此视图仅允许访问用户具有读取权限的表对应的pg_statistic行，因此可以安全地允许对此视图进行公共读取访问。\n\npg_stats也旨在以比底层目录更易读的格式呈现信息— 但其模式必须在为pg_statistic定义新的槽类型时进行扩展。","zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
