I have two tables where table A
has a geometry (4326) column that contains surfaces (~20M). A second table B
has ~ 500K points (4326). What I want to do is "flagging" (adding a boolean column) every single surface in A
that contains at least one of the points in B
.
I did this:
CREATE TABLE foo_data AS
SELECT
A.*,
(SELECT EXISTS (SELECT ST_Contains(A.geom, B.geom) FROM B)) as flagged
FROM A;
But I got all "flagged" values as true
(which is impossible).
With joins/lateral I didn't go far too.
Any idea?
MATERIALIZED VIEW