简体   繁体   English

如何查找现有表的新创建/更改列的时间?

[英]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.我正在amazon redshift做一个项目,我需要找到以下 3 点的数据。

  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.我设法使用系统表pg_class_info & pg_namespace [for #1] 和pg_tables [for #2] 解决了 #1 和 #2,但坚持第 3 点。 Can someone help me figure out ways to achieve the #3?有人可以帮我找出实现#3的方法吗? Please help .请帮忙

Note: Any better suggestions for #1 and #2 is also welcomed.注意:也欢迎对 #1 和 #2 提出更好的建议。

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对于第三个要求,没有直接答案 另一方面,通过查询系统视图 STL_QUERY,您可能会找到您要查找的内容

Here is the sample query这是示例查询

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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