Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial join very slow? #475

Open
bertt opened this issue Jan 10, 2025 · 0 comments
Open

Spatial join very slow? #475

bertt opened this issue Jan 10, 2025 · 0 comments

Comments

@bertt
Copy link

bertt commented Jan 10, 2025

Hi,

I'm executing the following query on a 147K world city points table (loaded parquet file from https://public.opendatasoft.com/explore/dataset/geonames-all-cities-with-a-population-1000/export/?disjunctive.cou_name_en&sort=name)

Find pairs of cities that are within 5 degrees (about 555 km) of each other.

but it ?never? finishes (v1.1.1 ) :-( PostGIS is ready within a second...

SELECT
    a.name AS city_a,
    b.name AS city_b,
    ST_Distance(
        a.coordinates,
        b.coordinates
    ) AS distance_degrees
FROM cities a
JOIN cities b ON a.geoname_id <> b.geoname_id
WHERE ST_Distance(
    a.coordinates,
    b.coordinates
) <= 5; -- Distance in degrees
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant