在Greenplum里面没有Oracle里面的sysdate,很多时候使用to_timestamp(current_timestamp,'yyyy-mm-dd hh24:mi:ss')代替;
但是在GP的函数中使用current_timestamp来记录日志,并不能达到效果,一个函数就是一个事务
因为在同一个事务中current_timestamp这个值是不变的,故取而代之使用clock_timestamp();
如select cast(to_timestamp(clock_timestamp(),'yyyy-mm-dd hh24:mi:SS') as timestamp without time zone)
本文介绍了在Greenplum数据库中如何正确使用时间戳功能。由于Greenplum不支持Oracle中的sysdate特性, 使用current_timestamp可能会导致同一事务内的时间戳值固定不变。因此, 文章推荐使用clock_timestamp()来获取更精确的当前时间。
3846

被折叠的 条评论
为什么被折叠?



