I am having trouble with finding table creation date in Amazon Redshift. I know svv_table_info will give all the info about the table but the creation date.Can anyone help pleas
It looks like no way to get the creation timestamp of tables in Redshift. One workaround is using STL_DDLTEXT table which records a history of DDLs including CREATE TABLE
.
Here is an example (test_table
is a table name):
dev=> select starttime, endtime, trim(text) as ddl from stl_ddltext where text ilike '%create%table%test_table%' order by endtime desc limit 1;
starttime | endtime | ddl
----------------------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------
2016-04-25 05:38:11.666338 | 2016-04-25 05:38:11.674947 | CREATE TABLE "test_table" (id int primary key, value varchar(24));
(1 row)
In the above case, starttime
or endtime
will be a timestamp of the test_table
table creation.
NOTE: