Dear Hackers

I've been working on an extension and using SPI to execute some queries. I am in a situation where I have the option to issue multiple queries concurrently, ideally under same snapshot and transaction. In short, I am achieving this by creating multiple dynamic background workers, each one of them executing a query at the same time using SPI_execute(sql_string, ...). To be more precise, sometimes I am also opting to issue a 'CREATE TABLE AS <sql_query>' command, an SPI utility command.

I was however wondering whether I can indeed achieve concurrency in this way. My initial results are not showing much difference compared to a not concurrent implementation. If there would be a large lock somewhere in SPI implementation obviously this can be counterintuitive. What would be the precautions I would need to consider when working with SPI in this manner?

Thanks,
Tom


Reply via email to