请问一个SQL语句的优化问题# Database - 数据库
k*s
1 楼
q is a table with only one field, snip (int), 180,000 records
ip2country is a table contain ip ranges for each country,
there are about 140,000 records.
我在做如下查询时,非常慢
select q.snip, p.country from q, ip2country as p
where q.snip >= p.ip_range_begin && q.snip <= p.ip_range_end
请问有什么方法可以进行优化?
多谢了
ip2country is a table contain ip ranges for each country,
there are about 140,000 records.
我在做如下查询时,非常慢
select q.snip, p.country from q, ip2country as p
where q.snip >= p.ip_range_begin && q.snip <= p.ip_range_end
请问有什么方法可以进行优化?
多谢了