pgpool 通过统计信息查看数据插入
2017-05-16 13:48
483 查看
192.168.16.112是pgpool的vip,192.168.16.110是节点1(主节点)的IP,192.168.16.111是备节点的IP。
[postgres@pgpool01 ~]$ psql -h 192.168.16.112 -p 9999 -d test
psql (9.5.6)
Type "help" for help.
test=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------+-------+----------
public | pgbench_accounts | table | postgres
public | pgbench_branches | table | postgres
public | pgbench_history | table | postgres
public | pgbench_tellers | table | postgres
(4 rows)
重置当前数据库的所有统计计数器
test=# select pg_stat_reset();
pg_stat_reset
---------------
(1 row)
查询以下表被插入的行数,被更新的行数,被删除的行数
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool01 ~]$ pgbench -h 192.168.16.112 -p 9999 -T 2 test
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
duration: 2 s
number of transactions actually processed: 202
latency average: 9.902 ms
tps = 100.991012 (including connections establishing)
tps = 102.044992 (excluding connections establishing)
[postgres@pgpool01 ~]$ psql -h 192.168.16.112 -p 9999 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 202 | 0
pgbench_accounts | 0 | 202 | 0
pgbench_history | 202 | 0 | 0
pgbench_branches | 0 | 202 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 202 | 0
pgbench_accounts | 0 | 202 | 0
pgbench_history | 202 | 0 | 0
pgbench_branches | 0 | 202 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
重置当前数据库的所有统计计数器
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select pg_stat_reset();
pg_stat_reset
---------------
(1 row)
[postgres@pgpool02 ~]$ pgbench -h 192.168.16.112 -p 9999 -T 2 test
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
duration: 2 s
number of transactions actually processed: 186
latency average: 10.787 ms
tps = 92.706306 (including connections establishing)
tps = 93.830588 (excluding connections establishing)
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 143 | 0
pgbench_accounts | 0 | 143 | 0
pgbench_history | 143 | 0 | 0
pgbench_branches | 0 | 143 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool01 ~]$ psql -h 192.168.16.112 -p 9999 -d test
psql (9.5.6)
Type "help" for help.
test=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------+-------+----------
public | pgbench_accounts | table | postgres
public | pgbench_branches | table | postgres
public | pgbench_history | table | postgres
public | pgbench_tellers | table | postgres
(4 rows)
重置当前数据库的所有统计计数器
test=# select pg_stat_reset();
pg_stat_reset
---------------
(1 row)
查询以下表被插入的行数,被更新的行数,被删除的行数
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool01 ~]$ pgbench -h 192.168.16.112 -p 9999 -T 2 test
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
duration: 2 s
number of transactions actually processed: 202
latency average: 9.902 ms
tps = 100.991012 (including connections establishing)
tps = 102.044992 (excluding connections establishing)
[postgres@pgpool01 ~]$ psql -h 192.168.16.112 -p 9999 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 202 | 0
pgbench_accounts | 0 | 202 | 0
pgbench_history | 202 | 0 | 0
pgbench_branches | 0 | 202 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 202 | 0
pgbench_accounts | 0 | 202 | 0
pgbench_history | 202 | 0 | 0
pgbench_branches | 0 | 202 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
重置当前数据库的所有统计计数器
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select pg_stat_reset();
pg_stat_reset
---------------
(1 row)
[postgres@pgpool02 ~]$ pgbench -h 192.168.16.112 -p 9999 -T 2 test
starting vacuum...end.
transaction type: TPC-B (sort of)
scaling factor: 1
query mode: simple
number of clients: 1
number of threads: 1
duration: 2 s
number of transactions actually processed: 186
latency average: 10.787 ms
tps = 92.706306 (including connections establishing)
tps = 93.830588 (excluding connections establishing)
[postgres@pgpool01 ~]$ psql -p 5432 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 143 | 0
pgbench_accounts | 0 | 143 | 0
pgbench_history | 143 | 0 | 0
pgbench_branches | 0 | 143 | 0
insert_lock | 0 | 0 | 0
(5 rows)
[postgres@pgpool02 ~]$ psql -p 5433 -d test
psql (9.5.6)
Type "help" for help.
test=# select relname,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;
relname | n_tup_ins | n_tup_upd | n_tup_del
------------------+-----------+-----------+-----------
pgbench_tellers | 0 | 0 | 0
pgbench_accounts | 0 | 0 | 0
pgbench_history | 0 | 0 | 0
pgbench_branches | 0 | 0 | 0
insert_lock | 0 | 0 | 0
(5 rows)
相关文章推荐
- 人工智能系统通过网络提高其性能 “信息提取”系统转换纯文本为可以统计分析的数据
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第三篇)
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第一篇)
- 大数据_Storm_教程一_通过Storm UI 查看_Storm集群的基本信息
- 通过使用第三方SDK来实现应用的分享,第三方登陆,数据信息统计等功能(ShareSDK)。
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第一篇)
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第三篇)
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第二篇)
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第三篇)
- 什么是使用记录访问权限呢?这是在Android5.0(Api level 21)新添加的,通过该权限我们可以查看设备上其它应用使用情况的统计信息等。
- SQLSERVER是怎麽通过索引和统计信息来找到目标数据的(第二篇)
- 通过 JVM 查看关于 Apache Geronimo 的统计信息
- 解决通过identity字段关联的多个数据表插入问题
- ADOMD.NET实现多维数据库数据挖掘相关信息查看功能
- C# 通过分析netstat -an所得信息 查看本机所监听的端口 及判断某端口是否可用
- 通过进程ID查看进程信息,调出进程线程集合,查看进程模块,并对其进行操作!
- 如何在sqlplus中查看oracle数据库sql语句执行计划,执行时间和统计信息
- SQL语句笔记,增加一个字段,统计该表内的数据信息
- 在通过数据绑定的菜单中插入Seperator
- vc++ 使用command 对象通过parameter 实现插入二进制数据