Answer the question
In order to leave comments, you need to log in
How to speed up geodata fetch query in PostgreSQL?
For example, there is a table of company addresses with 3 fields: company_id , lat , lon .
It is necessary to obtain the distances to the nearest address of each of the companies.
To work with geodata, I use the cube and earthdistance extensions .
I am running a query:
SELECT
company_id,
MIN(earth_distance(ll_to_earth(lat,lon), ll_to_earth(53.96,83.96))) AS distance
FROM companies
GROUP BY company_id;
CREATE INDEX i_name on companies USING gist(ll_to_earth(lat, lon));
Does not help. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question