Greenplum 如何確認暫存表

EDB Postgres 10 企業版裡面的 Partitioned Table 系統表
2018-02-06
Greenplum Vacuum Lock 測試
2018-02-06

本文作者:Ren

步驟如下:

1.查Ren這個帳號,在GPDB 中建了多少個 temp table

gpadmin=# SELECT * FROM pg_tables WHERE schemaname like 'pg_temp%' and tableowner='ren';

schemaname   | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers

---------------+-----------+------------+------------+------------+----------+-------------

 pg_temp_69393 | t1        | ren        |            | f          | f        | f

 pg_temp_69393 | t2        | ren        |            | f          | f        | f

 pg_temp_69393 | t3        | ren        |            | f          | f        | f

 pg_temp_69399 | t4        | ren        |            | f          | f        | f

(4 rows)

 

2.temp table 的大小

gpadmin=# select pg_size_pretty(pg_relation_size('pg_temp_69393.t1'));;

 pg_size_pretty

----------------

 182 MB

(1 row)

Time: 11.951 ms

Time: 0.151 ms

gpadmin=# select pg_size_pretty(pg_relation_size('pg_temp_69393.t2'));;

 pg_size_pretty

----------------

 34 MB

(1 row)

 

3.如何確認活動狀態

gpadmin=# select * from pg_stat_activity ;

 datid | datname | procpid | sess_id | usesysid | usename | current_query  | waiting | query_start 

 backend_start   | client_addr | client_port | application_name | xact_start  | waiting_reason

-------+---------+---------+---------+----------+---------+------------------------------------------------------+---------+-------------------------
30622 | gpadmin |   46241 |   69399 |    33496 | ren     | insert into t4 values(generate_series(1,150000000)); | f  | 2016-04-11 10:17:30.684044+08 | 2016-04-11 10:17:06.261786+08 |      |   -1 | psql    | 2016-04-11 10:17:30.684044+08 |