开发者社区 问答 正文

Hologres如何查询生命周期过期的表

已解决

Hologres如何查询生命周期过期的表

展开
收起
提个问题 2024-06-11 14:02:52 80 分享 版权
1 条回答
写回答
取消 提交回答
  • 开发者社区问答官方账号
    官方回答
    采纳回答

    Hlogres查询生命周期过期的表请参考:

    select * from (select case when currentnow-create_time :: DECIAML >= time_to_live_in_seconds :: decimal then 1 else 0 end as mark,t1.schema,t1.tables from (select a.table_namespace as schema,a.table_name as tables, a.property_values as time_to_live_in_seconds,b.property_value as create_time,EXTRACT(epoch from current_timestamp) as currentNow from hologres.hg_table_properties a join hologres.hg_table_properties b on a.table_name=b.table_name where a.property_key='time_to_live_in_seconds' and b.property_key ='create_time') as t1) t2 where t2.mark='1';


    2024-06-11 14:02:53
    赞同 展开评论