with as 物化成临时表

tech2025-04-19  8

/+ materialize/ 优化

被调用 1 次,不会放入临时表。 被调用 2 次及以上, CBO 优化器会自动把 with as 短语所获取的数据放入临时表中。

hint 关键字描述/+ materialize/会强制性要求 with as 中的结果转换为 临时表/+ inline/与上相反,不转换 WITH t_emp AS( SELECT /*+ materialize*/ e.empno, e.ename, e.sal FROM scott.emp e WHERE e.sal > (SELECT AVG(e_1.sal) FROM scott.emp e_1) ) SELECT * FROM t_emp;
最新回复(0)