> I still think that using a PL in the backend might be more performant > than having an external client, alone being the SPI interface more > efficient compared to the network serialization for external applications. I would actually love for this to work better, as this is technology that I would like to develop in general - I see db servers with strong server-side programming languages as being able to operate as application servers, with the enterprises business logic centralised on the server. The import routine that I wrote will actually work on the server as well - it will detect the presence of the spi_ calls, and replace the pg_* calls with spi_* calls. So, you see this WAS my intention. However, the last time I tried to run something that complex from the db server, it ran quite slowly compared to from a client. This may have had something to do with the client that I used to call the stored procedure - I thought that perhaps the client created an implicit transaction around my SQL statement to allow a rollback, and all of the updates and inserts got backed up in a massive transaction queue that took forever to commit. Carlo