I am interested in creating a list of all the IDs from Table_A and whether or not they intersect with any of the geometries from Table_B.
The following would work:
SELECT Table_A.id, bool_and(st_intersects(Table_A.geom, Table_B.geom) FROM Table_A, Table_B GROUP BY Table_A.id
The problem is that this means checking every geometry in Table_A against every geometry in Table_B which is very intensive. How do you query until you find the first intersect, return
TRUE and then move onto the next geometry in Table_A?
The extension to this, is to then check each row in Table_A for an intersect in several other tables, with the result as follows:
Table_A_ID | Table_B_Intersects | Table_C_Intersects | ... 0001 | True | False | ... ... | ... | ... | ...
This answer How to find all features in one table that intersect features in another table in PostGIS? from comments helps with the single case, but I cannot see how to apply it in this instance.
Edit: moved from comment, tried the following, but crashes pgAdmin:
SELECT Table_A.id, (CASE WHEN EXISTS (SELECT st_intersects(Table_A.geom, Table_B.geom)) THEN TRUE ELSE FALSE END) AS Table_B_Intersects, (CASE WHEN EXISTS (SELECT st_intersects(Table_A.geom, Table_C.geom)) THEN TRUE ELSE FALSE END) AS Table_C_Intersects, ... FROM Table_A, Table_B, Table_C, ...