Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@geozelot - adding an index on the timestamp column seemed like a great idea but unfortunately did not help. Does the query need any re-structuring before it can benefit from this new index? thanks so much.
@geozelot I am now making use of the geography index by using p."geoJson" as geom (not transforming anymore), and at the end doing ST_DWithin(u."geom"::geography, a."geom"::geography, 30). Still the geoJson column index is not mentioned in the query plan.
Also regarding what you said - "For 6 points only you could easily brute force the optimal solution (having only 6! = 720 permutations), but double that and your machine will burn." I tried this for 30 or so points and it was calculated in a couple of seconds!
One more thing, for each row in the result set, the optimized route is shown right? In terms of which id to visit first, then next, then next and so on - if I select uuid's in the final select clause instead of segment.