Column statistics
pg_column_statsInspect planner statistics for table columns without reading data: NULL fractions, distinct values, widths, common values, histograms and correlation. Use it to spot selective, skewed or empty columns before writing queries or indexes.
Instructions
Describe the data of each column from the planner statistics, without reading the table: fraction of NULLs, estimated number of distinct values, average width in bytes, the most common values with their frequency (up to 10), the range of the histogram, and the correlation with the physical order (near 1 or -1 means sorted).
Use it to see which columns are selective, skewed or mostly empty before writing a query or an index. The numbers come from the last ANALYZE; a table never analyzed has none, and the answer says so. For protected columns and columns whose name looks like a credential only the statistics are given, never sample values.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>"
},
"name": "pg_column_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| columns | No | ||
| connection | No |