I have a table with ~15K records consisting in points with a 200m buffer and I need to investigate how many of them are in proximity of polygons contained in another table (~20K).
I wrote a function (really simple one) which uses a record variable (rowgeo) and then uses ST_Overlaps like this:
SELECT gid FROM pi a WHERE ST_Overlaps(a.geom, rowgeo.buffer) INTO var
well, the function is dramatically slow... it's running since yesterday morning. Both tables have a gist index on geometry column.