且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

sql join语句中的表顺序是否有任何意义

更新时间:2023-01-19 22:37:09

没有.

大多数(如果不是全部)DBMS使用基于成本的优化器.您指定语句的顺序不会影响执行速度.

Most (if not all) DBMS's use of a Cost based optimizer. The order in which you specify your statements does not affect speed of execution.

基于Oracle SQL成本的优化

Oracle基于成本的SQL优化器(CBO)非常复杂Oracle的组件,它控制每个Oracle查询的执行.CBO已发展成为世界上最先进的组织之一软件组件,并且它具有评估任何具有挑战性的工作SQL语句,并为该语句生成***"执行计划声明.

Oracle's cost-based SQL optimizer (CBO) is an extremely sophisticated component of Oracle that governs the execution for every Oracle query. The CBO has evolved into one of the world's most sophisticated software components, and it has the challenging job of evaluating any SQL statement and generating the "best" execution plan for the statement.

您的两条语句都会生成相同的执行计划,因此具有相同的性能特征.请注意,费用将基于可用的统计数据.更新统计信息对于优化器能够生成最有效的执行计划非常重要.

Both your statements will generate the same execution plan and hence have the same perfomance characteristics. Note that the cost will be based on available statistics. Updated statistics is very important for the optimizer to be able to generate the most efficient execution plan.