mysql - Compare two columns with millions of records in PHP -


how compare 2 columns returned mysql db tables containing millions of records each? i'm comparing phone numbers tablea , tableb. numbers in tablea checked against numbers in tableb , duplicate numbers deleted if found. have used array_intersect($array1, $array2) since returned numbers stored in arrays. returns duplicate numbers problem consumes memory , takes forever execute.

is there way of doing without comsuming memory? numbers contained in tablea , tableb on 10 million each.

you can use query, return numbers present both in tablea , in tableb:

select distinct tablea.number tablea inner join tableb      on tablea.number = tableb.number 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -