Finding the nearest geo points across two tables?
Don't use ST_Distance. It will never use an index. Instead use KNN distance with &lt;->, and use ST_DWithin when possible.


  To find the nearest points from the table with 80M respect to 50M within 0.1 miles I run something like:


To find the nearest point, you can do..

SELECT A.latitude, A.longitude, B.latitude, B.longitude,
FROM my_table_50 AS A, my_table_80 AS B
ORDER BY A.geom &lt;-&gt; B.geom
LIMIT 1


To find the nearest point within one mile, 

SELECT A.latitude, A.longitude, B.latitude, B.longitude,
FROM my_table_50 AS A, my_table_80 AS B
WHERE ST_DWithin(A.geom, B.geom, 1609.34)
ORDER BY A.geom &lt;-&gt; B.geom
LIMIT 1


Also, unless your postgis is old don't ever do 

SELECT AddGeometryColumn('my_table_50/80', 'geom', 4326, 'POINT', 2);


From the docs,


  Changed: 2.0.0 This function no longer updates geometry_columns since geometry_columns is a view that reads from system catalogs. It by default also does not create constraints, but instead uses the built in type modifier behavior of PostgreSQL. So for example building a wgs84 POINT column with this function is now equivalent to: ALTER TABLE some_table ADD COLUMN geom geometry(Point,4326);


Make sure in the above you have a spatial/gist index on A.geom and B.geom. And, consider clustering both of them on those indexes.