I have two polygons layers with SRID 4326, indexed in a PostGIS database. Layer 1 is a country layer. I want to check whether the polygons (> 60k instances) from layer 2, fall inside the boundaries of 1 country only (1 polygon). So, once a polygon overlaps a country boundary (= falls inside multiple countries), I need to detect them. I used the ST_CONTAINS function of PostGIS:
SELECT
a.identifier, a.name, ST_Contains(c.geom, a.pol)
FROM
layer_polygons a, layer_countries c
WHERE
ST_Contains(c.geom, a.pol) = False
This gives wrong 'False' values (too many False's). Any idea what can be the problem and also how I can do this the best/most efficient (current query is very slow)?