pg_class.relpages pg_class.reltuples仅仅是近似值,和实际数据会有点误差;
新建空表。首次insert对自己主动收集和更新统计信息,影响的表pg_class\pg_stats。
对于insert操作:
analyze会更新表pg_class\pg_stats,而vacuum或者acuum full仅仅会更新pg_class。并不会更新不论什么统计信息pg_stats;
对于update\delete操作:
analyze会更新表pg_class\pg_stats,而vacuum或者acuum full仅仅会更新pg_class,并不会更新不论什么统计信息pg_stats;
可是vacuum full对于索引对象的pg_class.relpages貌似存在bug。仅仅有再次analyze或者vacuum才会正确更新pg_class;
gp_autostats_mode能够配置參数有:
NONE
ON_NO_STATS
ON_CHANGE
默认是ON_NO_STATS
gp_autostats_on_change_threshold參数配置阀值。与gp_autostats_mode配合使用,该值为临界值下限,比方80000。那么在超过80000也即等于80001的时候才会生效。

 
具体測试例如以下:
[gpadmin@wx60 ~]$ psql gtlions
psql (8.2.15)
Type "help" for help. gtlions=# \timing on
Timing is on.
gtlions=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.2.15 (Greenplum Database 4.2.7.2 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Feb 25 2014 18:05:04
(1 row) Time: 2.020 ms
gtlions=# \pset x
Expanded display is on.
gtlions=# select * from pg_settings where name ~ 'gp_autostats';
-[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_mode
setting | ON_NO_STATS
unit |
category | Developer Options
short_desc | Sets the autostats mode.
extra_desc | Valid values are NONE, ON_CHANGE, ON_NO_STATS. ON_CHANGE requires setting gp_autostats_on_change_threshold.
context | user
vartype | string
source | configuration file
min_val |
max_val |
-[ RECORD 2 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_on_change_threshold
setting | 2147483647
unit |
category | Developer Options
short_desc | Threshold for number of tuples added to table by CTAS or Insert-to to trigger autostats in on_change mode. See gp_autostats_mode.
extra_desc |
context | user
vartype | integer
source | configuration file
min_val | 0
max_val | 2147483647 Time: 4.464 ms
gtlions=# \q
[gpadmin@wx60 ~]$ gpconfig -c gp_autostats_on_change_threshold -v 80000
20141017:16:45:27:008114 gpconfig:wx60:gpadmin-[INFO]:-completed successfully
[gpadmin@wx60 ~]$ gpstop -u
20141017:16:45:32:008229 gpstop:wx60:gpadmin-[INFO]:-Starting gpstop with args: -u
20141017:16:45:32:008229 gpstop:wx60:gpadmin-[INFO]:-Gathering information and validating the environment...
20141017:16:45:32:008229 gpstop:wx60:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20141017:16:45:32:008229 gpstop:wx60:gpadmin-[INFO]:-Obtaining Segment details from master...
20141017:16:45:33:008229 gpstop:wx60:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.7.2 build 1'
20141017:16:45:33:008229 gpstop:wx60:gpadmin-[INFO]:-Signalling all postmaster processes to reload
.
[gpadmin@wx60 ~]$ psql gtlions
psql (8.2.15)
Type "help" for help. gtlions=# \pset x
Expanded display is on.
gtlions=# select * from pg_settings where name ~ 'gp_autostats';
-[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_mode
setting | ON_NO_STATS
unit |
category | Developer Options
short_desc | Sets the autostats mode.
extra_desc | Valid values are NONE, ON_CHANGE, ON_NO_STATS. ON_CHANGE requires setting gp_autostats_on_change_threshold.
context | user
vartype | string
source | configuration file
min_val |
max_val |
-[ RECORD 2 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_on_change_threshold
setting | 80000
unit |
category | Developer Options
short_desc | Threshold for number of tuples added to table by CTAS or Insert-to to trigger autostats in on_change mode. See gp_autostats_mode.
extra_desc |
context | user
vartype | integer
source | configuration file
min_val | 0
max_val | 2147483647 gtlions=# drop table if exists test;
DROP TABLE
gtlions=# create table test ( id int, name varchar(200),age int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
-[ RECORD 1 ]------
relname | test
relfilenode | 35843
relpages | 0
reltuples | 0
relhasindex | f
relnatts | 3 gtlions=# \pset x
Expanded display is off.
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35843 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select * from gp_toolkit.gp_stats_missing gtlions=# select * from gp_toolkit.gp_stats_missing where smitable='test';
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
public | test | f | 3 | 0
(1 row) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 20000;
INSERT 0 20000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35843 | 32 | 20000 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs |
histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+--------------------------------------------------------
--------------------------------------------------------------------------------------+-------------
public | test | id | 0 | 4 | -1 | | | {1,801,1601,2401,3201,4001,4801,5601,6401,7201,8001,880
1,9601,10401,11201,12001,12801,13601,14401,15201,16001,16801,17601,18401,19201,20000} |
public | test | name | 0 | 13 | -1 | | |
|
public | test | age | 0 | 4 | 1 | {39} | {1} | {39}
|
(3 rows) gtlions=# select * from gp_toolkit.gp_stats_missing where smitable='test';
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
(0 rows) gtlions=# \q
[gpadmin@wx60 ~]$ gpconfig -c gp_autostats_mode -v NONE
20141017:16:50:17:008707 gpconfig:wx60:gpadmin-[INFO]:-completed successfully
[gpadmin@wx60 ~]$ gpstop -u
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Starting gpstop with args: -u
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Gathering information and validating the environment...
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Obtaining Segment details from master...
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.7.2 build 1'
20141017:16:50:20:008822 gpstop:wx60:gpadmin-[INFO]:-Signalling all postmaster processes to reload
.
[gpadmin@wx60 ~]$ psql gtlions
psql (8.2.15)
Type "help" for help. gtlions=# \pset x
Expanded display is on.
gtlions=# select * from pg_settings where name ~ 'gp_autostats';
-[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_mode
setting | NONE
unit |
category | Developer Options
short_desc | Sets the autostats mode.
extra_desc | Valid values are NONE, ON_CHANGE, ON_NO_STATS. ON_CHANGE requires setting gp_autostats_on_change_threshold.
context | user
vartype | string
source | configuration file
min_val |
max_val |
-[ RECORD 2 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_on_change_threshold
setting | 80000
unit |
category | Developer Options
short_desc | Threshold for number of tuples added to table by CTAS or Insert-to to trigger autostats in on_change mode. See gp_autostats_mode.
extra_desc |
context | user
vartype | integer
source | configuration file
min_val | 0
max_val | 2147483647 gtlions=# drop table test;
DROP TABLE
gtlions=# \pset x
Expanded display is off.
gtlions=# create table test ( id int, name varchar(200),age int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 20000;
INSERT 0 20000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35866 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select * from gp_toolkit.gp_stats_missing where smitable='test';
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
public | test | f | 3 | 0
(1 row) gtlions=# analyze test;
ANALYZE
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35866 | 32 | 20000 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs |
histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+--------------------------------------------------------
--------------------------------------------------------------------------------------+-------------
public | test | id | 0 | 4 | -1 | | | {1,801,1601,2401,3201,4001,4801,5601,6401,7201,8001,880
1,9601,10401,11201,12001,12801,13601,14401,15201,16001,16801,17601,18401,19201,20000} |
public | test | name | 0 | 13 | -1 | | |
|
public | test | age | 0 | 4 | 1 | {32} | {1} | {32}
|
(3 rows) gtlions=# select * from gp_toolkit.gp_stats_missing where smitable='test';
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
(0 rows) gtlions=# \q
[gpadmin@wx60 ~]$ gpconfig -c gp_autostats_mode -v ON_CHANGE
20141017:16:52:15:009211 gpconfig:wx60:gpadmin-[INFO]:-completed successfully
[gpadmin@wx60 ~]$ gpstop -u
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Starting gpstop with args: -u
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Gathering information and validating the environment...
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Obtaining Segment details from master...
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.7.2 build 1'
20141017:16:52:18:009326 gpstop:wx60:gpadmin-[INFO]:-Signalling all postmaster processes to reload
.
[gpadmin@wx60 ~]$ psql gtlions
psql (8.2.15)
Type "help" for help. gtlions=# \pset x
Expanded display is on.
gtlions=# select * from pg_settings where name ~ 'gp_autostats';
-[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_mode
setting | ON_CHANGE
unit |
category | Developer Options
short_desc | Sets the autostats mode.
extra_desc | Valid values are NONE, ON_CHANGE, ON_NO_STATS. ON_CHANGE requires setting gp_autostats_on_change_threshold.
context | user
vartype | string
source | configuration file
min_val |
max_val |
-[ RECORD 2 ]---------------------------------------------------------------------------------------------------------------------------------
name | gp_autostats_on_change_threshold
setting | 80000
unit |
category | Developer Options
short_desc | Threshold for number of tuples added to table by CTAS or Insert-to to trigger autostats in on_change mode. See gp_autostats_mode.
extra_desc |
context | user
vartype | integer
source | configuration file
min_val | 0
max_val | 2147483647 gtlions=# \pset x
Expanded display is off.
gtlions=# drop table test;
DROP TABLE
gtlions=# create table test ( id int, name varchar(200),age int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'id' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 20000;
INSERT 0 20000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select * from gp_toolkit.gp_stats_missing where smitable='test';
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
public | test | f | 3 | 0
(1 row) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 20000;
INSERT 0 20000
gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 20000;
INSERT 0 20000
gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select count(*) from test;
count
-------
60000
(1 row) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 19999;
INSERT 0 19999
gtlions=# select count(*) from test;
count
-------
79999
(1 row) gtlions=# select count(*) from test;
count
-------
79999
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 1;
INSERT 0 1
gtlions=# select count(*) from test;
count
-------
80000
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 1;
INSERT 0 1
gtlions=# select count(*) from test;
count
-------
80001
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 10000;
INSERT 0 10000
gtlions=# select count(*) from test;
count
-------
90001
(1 row) gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 10000;
INSERT 0 10000
gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 10000;
INSERT 0 10000
gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 10000;
INSERT 0 10000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 80000;
INSERT 0 80000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,80000),generate_series(1,80000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 80000;
INSERT 0 80000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 0 | 0 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
------------+-----------+---------+-----------+-----------+------------+------------------+-------------------+------------------+-------------
(0 rows) gtlions=# insert into test select generate_series(1,90000),generate_series(1,90000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 80001;
INSERT 0 80001
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35889 | 574 | 361046 | f | 3
(1 row) gtlions=# select * from pg_stats where tablename='test';
schemaname | tablename | attname | null_frac | avg_width | n_distinct |
most_common_vals
|
most_common_freqs
| histogram_bounds | correla
tion
------------+-----------+---------+-----------+-----------+------------+-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
---+----------------------------------------------------------------------------------------------------------------------------------------------------------+--------
-----
public | test | id | 0 | 4 | -0.174002 | {1241,7638,3257,2327,1485,9298,2465,6481,6316,2423,1618,1694,5551,3915,6216,15550,11567,3513,3
088,18221,1274,7119,1266,5539,5937}
| {0.00020724,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.000
1727,0.0001727,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.0001381
6} | {2,1361,2586,3868,5172,6432,7736,9052,10533,12609,14761,16810,18829,22174,27068,31789,36502,41340,46046,50856,55455,60203,65163,69993,74722,79997,79998} | public | test | name | 0 | 13 | -0.174002 | {1241-aaa-bbb,1485-aaa-bbb,6316-aaa-bbb,9298-aaa-bbb,1618-aaa-bbb,7638-aaa-bbb,2327-aaa-bbb,64
81-aaa-bbb,3257-aaa-bbb,2465-aaa-bbb,2423-aaa-bbb,1266-aaa-bbb,8043-aaa-bbb,4306-aaa-bbb,7255-aaa-bbb,19759-aaa-bbb,6083-aaa-bbb,4287-aaa-bbb,14424-aaa-bbb,4623-aaa-bb
b,8661-aaa-bbb,4980-aaa-bbb,5161-aaa-bbb,8999-aaa-bbb,8694-aaa-bbb} | {0.00020724,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.0001727,0.000
1727,0.0001727,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.00013816,0.0001381
6} | | public | test | age | 0 | 4 | 11 | {19,10,74,32,68,35,75,5,65,93,46} | {0.224026,0.221021,0.217878,0.0573708,0.0556784,0.0546422,0.0538823,0.0300497,0.0290826,0.0285991
,0.0277701}
| {5,10,19,32,35,46,65,68,74,75,93} | (3 rows) gtlions=# truncate tabel test;
ERROR: syntax error at or near "test"
LINE 1: truncate tabel test;
^
gtlions=# truncate table test;
TRUNCATE TABLE
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 0 | 0 | f | 3
(1 row) gtlions=# insert into test select generate_series(1,90000),generate_series(1,90000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 90000;
INSERT 0 90000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<=79999;
UPDATE 79999
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<=79999;
UPDATE 79999
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<=80000;
UPDATE 80000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 144 | 90576 | f | 3
(1 row) gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<=80001;
UPDATE 80001
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35936 | 574 | 101174 | f | 3
(1 row) gtlions=# truncate table test;
TRUNCATE TABLE
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35995 | 0 | 0 | f | 3
(1 row) gtlions=# insert into test select generate_series(1,90000),generate_series(1,90000)||'-aaa-bbb',round(random()::numeric,2)*100 limit 90000;
INSERT 0 90000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35995 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<80000;
UPDATE 79999
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35995 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<80001;
UPDATE 80000
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35995 | 144 | 90576 | f | 3
(1 row) gtlions=# update test set name='a' where id<80002;
UPDATE 80001
gtlions=# select relname,relfilenode,relpages,reltuples,relhasindex,relnatts from pg_class where relname in ('test') order by relname;
relname | relfilenode | relpages | reltuples | relhasindex | relnatts
---------+-------------+----------+-----------+-------------+----------
test | 35995 | 466 | 66052 | f | 3
(1 row)

 
 
-EOF-

About stats collected的更多相关文章

  1. oratop 各个指标项说明

    Section 1- oratop and database/instance specifics spid       :oratop's server SPID connected to inst ...

  2. 长见识了,知道了collected和Graphite 这两个东东

    今天下午的讨论会议中,听到了两个名词collected和Graphite这是神马东东,以前在bingo的时候也没听说过,开完会下去查了下.原来他两是监控系统的啊.以前也从来没做过系统监控方面的项目,这 ...

  3. [转] MemCached 的 stats 命令

    Memcached有个stats命令,通过它可以查看Memcached服务的许多状态信息.使用方法如下:先在命令行直接输入telnet 主机名端口号,连接到memcached服务器,然后再连接成功后, ...

  4. [原创博文] 用Python做统计分析 (Scipy.stats的文档)

    [转自] 用Python做统计分析 (Scipy.stats的文档) 对scipy.stats的详细介绍: 这个文档说了以下内容,对python如何做统计分析感兴趣的人可以看看,毕竟Python的库也 ...

  5. Process Stats:了解你的APP如何使用内存(转)

    原文地址:http://android-developers.blogspot.com/2014/01/process-stats-understanding-how-your.html?m=1 原作 ...

  6. Unity 5 Stats窗口

    Unity5的 Statistics上的统计信息和Unity4 有一些区别, Statistics窗口,全称叫做 Rendering Statistics Window,即渲染统计窗口(或渲染数据统计 ...

  7. memcached实战系列(四)memcached stats命令 memcached优化

    memcached提供一系列的命令进行优化的查看,方便我们调整我们的存储策略,查看我们的使用率,内存的使用率以及浪费情况.常用的命令有stats.stats settings.stats items. ...

  8. x264 n-th pass编码时候Stats文件的含义

    x264 n-th pass(一般是2pass)编码时所用的文件包括下述x264参数生成.stats文件 options: 1280x816 fps=2997/125 timebase=125/299 ...

  9. Scipy教程 - 统计函数库scipy.stats

    http://blog.csdn.net/pipisorry/article/details/49515215 统计函数Statistical functions(scipy.stats) Pytho ...

随机推荐

  1. T-SQL备忘(6):常用内置函数

    日期和时间函数: 1.获取当前时间:GETDATE() select GETDATE() 返回: 2015-04-27 20:52:06.700 2.返回时间的部分(日.月.年) a.获取日: sel ...

  2. php5.5 安装

    1.php安装 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum install zl ...

  3. 阅读 CMakeLists

    新手,入门阅读 CMakeLists,希望读者能给点建议 发现两篇文章,我感觉很好~ <阅读 CMakeLists>(下面只copy此篇)文章来源:http://blog.sina.com ...

  4. python的版本会导致IBus设置(中文输入法)出错

    最近在学习python,可是,发现我的输入法 IBus-pinyin ,不能用了, 现象: 发现 “首选输入法”,根本点击不进去IBus设置的窗口,想去设置输入法都不行, IBus设置的窗口: 原因是 ...

  5. POJ 1679 The Unique MST 【最小生成树/次小生成树模板】

    The Unique MST Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22668   Accepted: 8038 D ...

  6. Trie树【P3879】 [TJOI2010]阅读理解

    Description 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. Input 第一行为整数N,表示短文 ...

  7. Struts2与Servlet之间的关系

    在struts2.0中,可以通过ServletActionContext.getRequest()获取request对象. 在action的方法中return一个字符串,该字符串对应struts.xm ...

  8. SOCKET类型定义及应用

    读代码时看到此处,摘记下来. 流套接字(SOCK_STREAM):流套接字用于提供面向连接.可靠的数据传输服务.该服务将保证数据能够实现无差错.无重复发送,并按顺序接收.流套接字之所以能够实现可靠的数 ...

  9. (疯狂java)第四课(上)

    趁着周末玩爽了,兴致来了,继续玩玩java(估计再玩下去,就要被java玩了),第六章实在是很长,那就两个阶段来看吧. 1.java 7的增强包装类 这些包装类就是java上的基本类型,只不过人人基本 ...

  10. (原创)Stanford Machine Learning (by Andrew NG) --- (week 7) Support Vector Machines

    本栏目内容来源于Andrew NG老师讲解的SVM部分,包括SVM的优化目标.最大判定边界.核函数.SVM使用方法.多分类问题等,Machine learning课程地址为:https://www.c ...