數據庫優化之子查詢優化

1. 案例 取所有不爲掌門人的員工,按年齡分組! select age as '年齡', count(*) as '人數' from t_emp where id not in (select ceo from t_dept where ceo is not null) group by age; 如何優化? ①解決dept表的全表掃描,建立ceo字段的索引: 此時,再次查詢: ②進一步優化,
相關文章
相關標籤/搜索