Jump to content

Exciting geoDB query needs help :)


Jon N

Recommended Posts

table1 = 6,300,000 rows

Index: DB1.table1.IP

[4] Fields used: DB1.table1.IP, DB1.table1.lat, DB1.table1.long, DB1.table1.current

 

table2 = 1,400,000 rows

Index: DB2.table2.id_a

[1] Fields used: DB2.table2.id_a

 

table3 = 718,000 rows

Index: DB2.table3.id_a

[3] Fields used: DB2.table3.id_a, DB2.table3.IP, DB2.table3.option

 

__________________________________________________________________

 

 

SELECT

DB1.table1.lat,

DB1.table1.long,

Count(DB2.table2.id_a) AS count_all

 

FROM

DB2.table3

Inner Join DB2.table2 ON DB2.table2.id_a = DB2.table3.id_a

Inner Join DB1.table1 ON DB2.table3.IP = DB1.table1.IP

 

WHERE

DB2.table3.option = '-1'

AND

DB1.table1.current = 'AB'

 

GROUP BY

DB1.table1.lat,

DB1.table1.long

 

LIMIT 2000

Link to comment
https://forums.phpfreaks.com/topic/114315-exciting-geodb-query-needs-help/
Share on other sites

EXPLAIN SELECT:

 

id select_type table type possible_keys key key_len ref rows Extra

1SIMPLEtable2indexid_aid_a4(Null)1,412,817Using index; Using temporary; Using filesort1SIMPLEtable3refPRIMARY,id_aPRIMARY4DB2.table2.id_a1Using where1SIMPLEtable1eq_refPRIMARY,IPPRIMARY4DB2.table3.IP1Using where

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.