PostgreSQL的pg_stats学习

前端之家收集整理的这篇文章主要介绍了PostgreSQL的pg_stats学习前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

对于pg_stas,说明文档在这里:

http://www.postgresql.org/docs/9.1/static/view-pg-stats.html

下面做一个实验:

先建立一个表

postgres=# create table test(id integer);
CREATE TABLE
postgres=# \x
Expanded display is on.
postgres=# 

此后,观察 pg_stats 中与test表相关的数据,结果是还没有数据。

postgres=# \d pg_stats;
        View "pg_catalog.pg_stats"
      Column       |   Type   | Modifiers 
-------------------+----------+-----------
 schemaname        | name     | 
 tablename         | 
 attname           | 
 inherited         | boolean  | 
 null_frac         | real     | 
 avg_width         integer  | 
 n_distinct        | 
 most_common_vals  | anyarray | 
 most_common_freqs real[]   | 
 histogram_bounds  | 
 correlation       | 

postgresselect * from pg_stats where tablename='test';
(No rows)

然后,插入两条数据后看看有何变化:

猜你在找的Postgre SQL相关文章