I use PostgreSQL 9.1 The scenario is: I receive heavy insertion into Table1 (about 100 rows a sec). For each new entry, I have to check it with the previous and next ones (check if those items are inside an area using ST_DWithin). Depending on the result, what I need to do is: use the new entry (joining another table) to insert/update into new table. My Questions are:
I used to use Trigger to do the checking and insertion/updating. the header is as follows:
CREATETRIGGER ts_trigger AFTER INSERTON table1 FOR EACH ROWEXECUTEPROCEDURE test_trigger();
But I don't think it's the efficient way to do it.
I'm inserted in using batches. I'd like to understand the technique but cannot find a good resources for this.
Some advise me to use temp table, but I don't think it would be useful in my case.