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. 【JBPM4】获取任务

    示例代码: <?xml version="1.0" encoding="UTF-8"?> <process name="test&q ...

  2. Windows10 Docker加速

    参考地址:https://blog.csdn.net/wanderlustlee/article/details/80216588 在刚开始使用时,有可能因为网络的问题导致整个镜像的下载过程不是太顺畅 ...

  3. react native android 上传文件,Nodejs服务端获取上传的文件

    React Native端 使用react-native-image-picker 做出选择图片的操作,选择完成后,直接将图片Post至服务器,保存在服务器的某个地方(保存图片的路径需要公开显示),并 ...

  4. Nodejs创建简单的Bot

    官方文档地址:https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-quickstart 前提: 1.你已经 ...

  5. php 通过类名获取类的文件地址

    $reflector = new ReflectionClass("Child"); $fn = $reflector->getFileName(); return dirn ...

  6. bWAPP练习--injection篇之HTML Injection - Reflected (GET)

    什么是Injection? injection,中文意思就是注入的意思,常见的注入漏洞就是SQL注入啦,是现在应用最广泛,杀伤力很大的漏洞. 什么是HTML injection? 有交互才会产生漏洞, ...

  7. Linux命令之find(二)

    接上一篇Linux命令之find(一) (1).实例 1.列出当前目录下及子目录下所有的.txt文件 [xf@xuexi ~]$ ls 1.txt 3.txt b.txt 公共 视频 文档 音乐 2. ...

  8. 【BZOJ 1036】【ZJOI 2008】树的统计Count

    http://www.lydsy.com/JudgeOnline/problem.php?id=1036 复习了一下好写好调的lct模板啦啦啦--- #include<cstdio> #i ...

  9. JDBC 编程初步

    JDBC 概述 什么是JDBC 是一种用于执行SQL语句的Java API,它由一组用Java语言编写的类和接口组成,JDBC提供了一种操作数据的标准,JDBC的目标是使Java程序员使用JDBC可以 ...

  10. [JSOI2017]原力(分块+map(hash))

    题目描述 一个原力网络可以看成是一个可能存在重边但没有自环的无向图.每条边有一种属性和一个权值.属性可能是R.G.B三种当中的一种,代表这条边上 原力的类型.权值是一个正整数,代表这条边上的原力强度. ...