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
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.