Quantcast
Channel: 質問!ITmedia 新着質問(PostgreSQL/702)
Viewing all articles
Browse latest Browse all 116

抽出に時間がかかります。

$
0
0
同じテーブルを比較したいのですが、数百件だと時間がかからず、数万件となると抽出に数分かかります。速く抽出するにはどのように修正すればよいでしょうか? 以下がSQL文です。 select distinct sch1.schedule_id from ( select a.schedule_id , a.jigyou_id from a left outer join b on a.schedule_id = b.schedule_id ) as sch1, ( select a.schedule_id , a.jigyou_id from a left outer join b on a.schedule_id = b.schedule_id ) as sch2 where sch1.schedule_id != sch2.schedule_id and EXISTS (select sch1.jigyou_id from a where sch1.jigyou_id='aaa') and EXISTS (select sch2.jigyou_id from a where sch2.jigyou_id='aaa')

Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>