I have 2 Polygon layers. 3.5 million records of all NJ Parcels and a 1 record state wide polygon shapefile of NJ. My goal is to emulate the ArcGIS erase analysis too where I would essentially erase all the areas in the NJ shapefile where the 3.5 million parcels intersect and what I would be left with is a statewide polygon of all NJ roadways.
Here is the query I have put together, it seems fairly straightforward but my question is threefold. 1. should I be using st_intersects instead of && 2. is my query constructed correctly so it will achieve my results? 3. is there a faster way for me to construct this query? indexes, etc.. because it has been running for about an hour already.
create table streetbyerase as
select st_difference(parcels.geom,nj.geom) as geom
from parcels,nj
where parcels.geom && nj.geom