I need to select all entries from a table, that are within a distance from a point.
Each entry is a point geometry (I set a gist index on
Current runtime is anywhere between 3-15 seconds, depends on how many entries are in a given area (I think), but I'm trying to improve that to under 3sec.
I've seen a few posts on different ways to speed this up, including using
ST_DWithin but it does not seem to improve performance, neither does casting to
Any ideas how to proceed?
Here's a sample query:
SELECT * FROM T1 WHERE entry_date >= current_date - interval '1' month AND ST_DistanceSphere(geom, ST_MakePoint(-74.00072343, 40.7209235)) <= 1000;