【问题标题】:Time to execute script file with psql是时候用 psql 执行脚本文件了
【发布时间】:2016-10-21 01:59:58
【问题描述】:

我有一个包含多个 SQL 语句的脚本文件。我知道如何获得执行每条语句的时间。我在psql 内部使用\i 选项运行它。有没有办法获取或打印文件的总时间?换句话说,合并时间?

使用 PostgreSQL 9.4。

【问题讨论】:

  • 临时变量添加它们?

标签: postgresql psql


【解决方案1】:

假设bash环境友好:

$ time psql <<connection settings>> < script.sql

样本输出:

$ time sleep 3

real    0m3.001s
user    0m0.000s
sys     0m0.000s

您对“真实”价值感兴趣。有关这些值的更多信息:What do 'real', 'user' and 'sys' mean in the output of time(1)?

【讨论】:

    猜你喜欢
    • 2013-04-19
    • 2020-04-15
    • 1970-01-01
    • 2021-05-30
    • 2011-09-25
    • 1970-01-01
    • 2013-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多