两表的id都建有索引吗?
试试看:
select a.* from A a,B b where a.id=b.id;select * from A
minus
select a.* from A a,B b where a.id=b.id;

解决方案 »

  1.   

    把基础表放在最为靠近from的地方。创建索引列。
      

  2.   

    因为你的两个表都是数据量很大,即使你建索引,因为A.id=B.id,语句也要进行全表扫描,才能匹配所有条件,也会很慢,建议你先建一个中间表tab_tmp,然后从a或b一个表中选出想要得数据,缩小数据量,然后通过中间表tab_tmp与另一个表关联,这个时候使用索引,试试看。
      

  3.   

    id建索引
    select id from a
    minus
    select id from b