sql 优化
SELECT L_SUPPKEY, COUNT(*)
FROM LINEITEM
GROUP BY L_SUPPKEY
UNION
SELECT S_SUPPKEY, 0
FROM SUPPLIER
WHERE S_SUPPKEY NOT IN ( SELECT L_SUPPKEY
FROM LINEITEM );
这样一个sql,怎么样改才能减少他的physical and logical read
[解决办法]
select SUPPLIER.S_SUPPKEY,count(LINEITEM.L_SUPPKEY)from SUPPLIERleft join LINEITEM on SUPPLIER.S_SUPPKEY=LINEITEM.L_SUPPKEYgroup by SUPPLIER.S_SUPPKEY;--少了个