这样一个句子
select a.yhlb, count(*) from tableA a, tableB b where a.yhdm=b.yhdm
group by a.yhlb
就是按yhlb来统计表数,要150秒,怎么才能快点?
...全文
16117打赏收藏
大表联结的问题
tableA,用户资料 yhdm(用户代码 主键), yhlb (用户类别) tableB,用户的电表 yhdm,dbh(水表号) 表B的主键是(yhdm,dbh),表A的yhlb建有索引 两个表都有20万以上的记录 这样一个句子 select a.yhlb, count(*) from tableA a, tableB b where a.yhdm=b.yhdm group by a.yhlb 就是按yhlb来统计表数,要150秒,怎么才能快点?