【问题标题】:PLSQL: Which one of the join is good in performancePLSQL:哪个join性能好
【发布时间】:2017-11-30 13:31:46
【问题描述】:

请帮助我从性能角度了解以下两个查询中哪一个是好的。我检查了两个查询的解释计划成本相同。

1)

select tbl_LP.fn FNr, s.sourceNr SNr, Product.quantity
    from tbl_Source s, tbl_LP, Product
    where Product.tbl_Source_id=s.id and Product.tbl_LP_m_id=tbl_LP.id
    and s.sourceNr like 'T%';

2)

Select tbl_LP.fn FNr, s.sourceNr SNr, Product.quantity
    from tbl_Source s 
            INNER JOIN Product ON Product.tbl_Source_id=s.id AND s.sourceNr like 'T%'
            INNER JOIN tbl_LP ON Product.tbl_LP_m_id=tbl_LP.id;

【问题讨论】:

  • 从性能的角度来看,它们是相同的,正如解释计划所示。它们在逻辑上是相同的,只是用不同的语法表达。

标签: oracle11g


【解决方案1】:

完全没有区别。这是关于您更喜欢如何阅读/维护您的查询。我更喜欢连接方法,因为您将表之间的链接与您可能拥有的过滤器隔离开来。但是,归根结底,执行计划是查看查询是否会以某种方式更好地执行的指南。我发现this other question提供了很好的例子。

What's the difference between comma separated joins and join on syntax in MySQL?

【讨论】:

    猜你喜欢
    • 2015-01-09
    • 2015-01-19
    • 1970-01-01
    • 2014-08-13
    • 2022-01-20
    • 2010-11-16
    • 2012-10-02
    • 1970-01-01
    • 2013-03-12
    相关资源
    最近更新 更多