Quote (carteblanche @ Apr 22 2015 07:58pm)
first thing you should do is run explain plan. indexes may help. if you still have problems, post here with the explain plan.
how long does it take without distinct? what are the row counts for distinct vs non distinct?
you may be able to play around with subselects with the distinct keyword since only two of the tables have the dupes, but we'll get to that later.
Without the distinct portion, it runs rather quickly. With the distinct, I ran it for minutes and it didn't work. I think I literally let it run for 5 minutes.