Thread: Getting rid of nested loop

Getting rid of nested loop

From
Rod Taylor
Date:
I set nested_loop = off, which is why I have the high cost.

@ is a postgis operator between 2 geomotries (both polygons). It's the @
operator which is expensive. Is there a way to force a cheaper way of
doing that join?

         ->  Nested Loop  (cost=100001905.94..100001906.08 rows=1
width=68) (actual time=1739.368..17047.422 rows=100 loops=1)
               Join Filter: ((COALESCE("outer".geom, "outer".geom) @
COALESCE("inner".geom, "inner".geom)) AND ("outer".region_id <>
"inner".region_id))