Re: Top 10 airports referenced from a table of flights
Works! And another factor of ten or so faster, even after throwing in a join to get the airport names etc:
select a.name, a.iata, sum(x.ct) as count from
( select src_apid as apid, count(*) as ct
from flights
GROUP BY src_apid
UNION ALL
select dst_apid as apid, count(*) as ct
from flights
GROUP BY dst_apid
) x, airports as a
where a.apid=x.apid
group by x.apid
order by count desc
limit 10;
~4s with previous query, now down to 0.33s.
Subject
Views
Written By
Posted
5124
June 09, 2009 12:40AM
2195
June 11, 2009 10:46PM
2246
June 11, 2009 10:48PM
2361
June 15, 2009 10:16AM
2221
June 15, 2009 10:23PM
Re: Top 10 airports referenced from a table of flights
3286
June 16, 2009 03:35AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.