I have a large amount of point data that I have in CSV form. I am able to insert it all into a PostGIS table no problem. What I want to do though, is split the data up on insert into multiple separate tables. The data is statewide and I would like to have separate tables for each county within the state.
I know I could insert all of the points into a temp table and then INSERT INTO each county based on an ST_Intersect() but is there a better way of doing this? Some sort of trigger function that will run faster? Or is there a way to use a CONSTRAINT on each table where anything within/not within a certain polygon is rejected?
Edit: Sorry for the change but we ended up changing how we wanted to store the data: One table for our county of interest and another for the rest of the data because we occasionally need it. The other answers were not quite what we were looking for, we really wanted to avoid temp tables and adding fields and I did come up with a solution for it.