【问题标题】:how works commit timestamp internally如何在内部提交时间戳
【发布时间】:2022-06-28 04:18:13
【问题描述】:

这些文件存在于文件夹 /pg_commit_ts

-rw-------.  1 postgres postgres 262144 Jun 17 12:56 0000
-rw-------.  1 postgres postgres 262144 Jun 17 12:56 0001
-rw-------.  1 postgres postgres 262144 Jun 17 12:57 0002
...

是否只有在 track_commit_timestamp 开启时才创建这些文件?

【问题讨论】:

  • 测试一下。关闭 track_commit_timestamp 并运行一组事务,看看会发生什么。
  • 感谢您的建议。你知道是否有可能得到最后提交的语句?
  • 也许取决于您的确切需要。请参阅文档System Information Functions and Operators

标签: postgresql


【解决方案1】:

是的,这些文件仅在track_commit_timestamp = on 时创建。您无法获取最后提交的语句,但您可以使用 pg_last_committed_xact() 获取最后提交的事务的时间戳和事务 ID(请参阅the documentation)。

【讨论】:

    猜你喜欢
    • 2010-12-06
    • 2010-10-02
    • 2021-12-11
    • 2011-04-18
    • 2018-05-14
    • 1970-01-01
    • 2015-08-27
    相关资源
    最近更新 更多