简体   繁体   中英

How to find the time of newly created/altered columns of an existing table?

I am working on a project in amazon redshift and I need to find the data for the below 3 points.

  1. Created time of a table across all schemas
  2. Owner/user of the table created
  3. Plus, time and any schema changes of an existing table [that underwent newly created/altered columns].

I was managed to solve #1 and #2 using system tables pg_class_info & pg_namespace [for #1] and pg_tables [for #2] but stuck with point #3. Can someone help me figure out ways to achieve the #3? Please help .

Note: Any better suggestions for #1 and #2 is also welcomed.

For the third requirement, there is not a direct answer On the other hand by querying the system view STL_QUERY you might find what you are looking for

Here is the sample query

select
userid, starttime, querytxt 
from STL_QUERY 
where querytxt like '%alter%table%'
limit 10;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM