Eu tenho uma consulta PostGIS que retornará vários milhões de linhas: SELECT t1.id AS id1, t2.id AS id2, ABS(t1.mean_h - t2.mean_h) AS h_diff, ST_Distance(t1.the_geom, t2.the_geom) AS dist FROM tas_ponds as t1, tas_ponds as t2 WHERE (t1.gid > t2.gid) AND ST_DWithin(t1.the_geom,...