ST_Disjoint
What is ST_Disjoint?
ST_Disjoint is a PostGIS spatial predicate that returns true when two geometries have no points in common. It is the logical opposite of ST_Intersects: ST_Disjoint(A, B) is equivalent to NOT ST_Intersects(A, B).
ST_Disjoint(geometry geomA, geometry geomB) → booleanThe DE-9IM pattern is FF*FF****.
When would you use ST_Disjoint?
Use ST_Disjoint to select features that do not interact with another layer — parcels that do not touch a flood zone, stops that are not served by any line, or sensors outside the area of interest. In practice, most query planners perform better when you write this as NOT ST_Intersects(...) because that form can leverage a spatial index, while ST_Disjoint cannot.
1SELECT p.id
2FROM parcels p
3WHERE NOT EXISTS (
4 SELECT 1 FROM flood_zones f WHERE ST_Intersects(p.geom, f.geom)
5);FAQs
Why is ST_Disjoint not index-accelerated?
Spatial indexes find geometries whose bounding boxes overlap. "Disjoint" means everything the index does not return, so the index doesn't help directly. Always rewrite disjoint checks as NOT ST_Intersects(...) or an anti-join using NOT EXISTS, which lets PostgreSQL use the GiST index on the intersecting side.
Is ST_Disjoint the same as "not touching"?
No — "disjoint" is stricter. Two polygons sharing a single boundary point are not disjoint (they touch), but they are also not overlapping. Disjoint means they share absolutely no points in common, not even on the boundary.
Does ST_Disjoint work on geography?
The geometry overload is standard. For geography, use NOT ST_Intersects(geog1, geog2) which handles the sphere correctly and is also index-accelerated.
What does ST_Disjoint return for empty geometries?
If either input is empty, ST_Disjoint returns true, because an empty geometry shares no points with anything. Be careful when your dataset may contain empty geometries from trimming or difference operations — they will always appear "disjoint" from everything else.