I have created 2 geography columns and indexed them using GIST. I am looking to use ST_DWithin for a larger dataset and to make it faster trying to use the use_spheroid=false.

SELECT pois.objectid, ST_Multi(ST_Union(polygon.coordinates)) as coords   
              into table3
              FROM table1 as polygon 
              INNER JOIN table12 as pois 
              ON ST_DWithin(polygon.geog,pois.geog, 10* 1609.34, use_spheroid=false)
              group by pois.objectid
            limit 1;

but I get the following error,

ERROR:  column "use_spheroid" does not exist

I feel that I am not using the use_spheroid=false argument correctly. Could you please help me?


Just set it to false without naming it.

ST_DWithin(polygon.geog,pois.geog, 10* 1609.34, false)
| improve this answer | |
  • Thanks. Looks like there is no real improvement in time. I tried for 10 points pois.geog and it take 1 min in both the cases. I have 16 million to run. Any advice to improve this? – Shana Mar 29 '18 at 11:36
  • @Shana Please consider accepting the answer (green check mark to the left) so others know it is a working solution. For the query speed, please ask a new question with more details such as result of explain analyze, list of indexes etc – JGH Mar 29 '18 at 11:46
  • Thanks @JGH. I have posted a new question, gis.stackexchange.com/questions/277603/… – Shana Mar 29 '18 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.