【问题标题】:Is the performance of trunc(sysdate-1) and trunc(sysdate)-1 different?trunc(sysdate-1) 和 trunc(sysdate)-1 的性能有区别吗?
【发布时间】:2013-04-10 06:04:24
【问题描述】:

他们两个都是前一天返回的,到目前为止我还没有发现其中一个存在性能问题的案例。

但出于好奇,我真的想知道在查询中使用 trunc(sysdate-1)trunc(sysdate)-1 是否存在性能差异?

【问题讨论】:

    标签: sql performance oracle11g


    【解决方案1】:

    实际上,没有。与代表昨天的truncdate 相比,代表今天某个时间点的truncdate 并不昂贵。从 date 中减去一天(表示某个午夜的某天)并不比一个 date (表示某个其他时间)更昂贵。

    【讨论】:

      【解决方案2】:

      我认为这两种情况下的性能是相同的。 参考this链接。

      【讨论】:

        猜你喜欢
        • 2010-12-15
        • 2012-08-17
        • 2021-01-16
        • 2018-06-02
        • 1970-01-01
        • 2020-02-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多