Re: How can I optimize this query?
Posted by:
Rick James
Date: March 27, 2010 03:36PM
See if this is closer to finding all the results in a single query:
SELECT cl.country, cl.region, cl.city
FROM ( SELECT
( SELECT endIpNum
FROM geoipdb.CityBlocks
WHERE endIpNum >= o.longip
ORDER BY endIpNum
LIMIT 1
) AS endIpNum
FROM ( SELECT distinct longip FROM whyu.stats ) o
) a
JOIN geoipdb.CityBlocks cb ON cb.endIpNum = a.endIpNum
JOIN geoipdb.CityLocation cl ON cl.locId = cb.locId;
This requires a UNIQUE index on cb.endIpNum.
Subject
Views
Written By
Posted
5540
March 12, 2010 02:40PM
2424
March 13, 2010 04:07PM
1847
March 13, 2010 04:17PM
2005
March 16, 2010 08:22AM
2517
April 14, 2010 02:27AM
2014
March 16, 2010 07:58AM
1921
March 16, 2010 08:16AM
1927
March 16, 2010 08:21AM
1937
March 16, 2010 08:16AM
1926
March 16, 2010 09:40AM
1965
March 16, 2010 01:59PM
Re: How can I optimize this query?
1960
March 27, 2010 03:36PM
1708
April 14, 2010 07:21AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
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.