How to find last ALTAR TABLE DDL on a table in Greenplum

Post date: Nov 04, 2014 10:1:57 PM

sachi=# \d sachi.abc

             Table "sachi.abc"

 Column |         Type          | Modifiers 

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

 id     | numeric               | 

 name   | character varying(10) | 

Indexes:

    "abc_id" btree (id)

Distributed by: (id)

sachi=# alter table sachi.abc set distributed RANDOMLY;

ALTER TABLE

sachi=# 

sachi=# select *  from gp_toolkit.__gp_log_master_ext where upper(logmessage) like '%ALTER TABLE ABC SET DISTRIBUTED%';

            logtime            | loguser | logdatabase | logpid |   logthread   | loghost | logport |     logsessiontime     | logtransaction | logsession | 

logcmdcount | logsegment | logslice | logdistxact | loglocalxact | logsubxact | logseverity | logstate |                                                     

    logmessage                                                         | logdetail | loghint | logquery | logquerypos | logcontext |                         

                           logdebug                                                     | logcursorpos | logfunction |  logfile   | logline | logstack 

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

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

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

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

 2014-11-01 11:56:12.905493-04 | gpadmin | sachi       | p29844 | th1857120000  | [local] |         | 2014-11-01 11:56:12-04 |         602241 | con2084    | 

cmd2        | seg-1      |          | dx7452      | x602241      | sx1        | LOG         | 00000    | statement: ALTER TABLE abc set DISTRIBUTED by (id); 

                                                                       |           |         |          |             |            | ALTER TABLE abc set DIST

RIBUTED by (id);                                                                        |            0 |             | postgres.c |    1542 | 

 2014-11-01 12:04:59.105461-04 | gpadmin | sachi       | p30189 | th1857120000  | [local] |         | 2014-11-01 12:04:59-04 |         602243 | con2086    | 

cmd6        | seg-1      |          | dx7453      | x602243      | sx1        | LOG         | 00000    | statement: ALTER TABLE abc set DISTRIBUTED by (id); 

                                                                       |           |         |          |             |            | ALTER TABLE abc set DIST

RIBUTED by (id);                                                                        |            0 |             | postgres.c |    1542 | 

 2014-11-04 16:53:10.159778-05 | gpadmin | sachi       | p31819 | th-1797327104 | [local] |         | 2014-11-04 16:51:25-05 |         605531 | con11      | 

cmd28       | seg-1      |          | dx130       | x605531      | sx1        | LOG         | 00000    | statement: alter table abc set distributed RANDOMLY;

                                                                       |           |         |          |             |            | alter table abc set dist

ributed RANDOMLY;                                                                       |            0 |             | postgres.c |    1542 | 

 2014-11-04 17:00:48.018962-05 | gpadmin | sachi       | p31303 | th-1797327104 | [local] |         | 2014-11-04 16:40:24-05 |         605543 | con10      | 

cmd250      | seg-1      |          | dx142       | x605543      | sx1        | LOG         | 00000    | statement: select *  from gp_toolkit.__gp_log_master

_ext where upper(logmessage) like '%ALTER TABLE ABC SET DISTRIBUTED%'; |           |         |          |             |            | select *  from gp_toolki

t.__gp_log_master_ext where upper(logmessage) like '%ALTER TABLE ABC SET DISTRIBUTED%'; |            0 |             | postgres.c |    1542 | 

(4 rows)

sachi=#