Hi, buddies!
I'm new to PG and want to implement my domain-specific system based on PG. I wish to arrange my data as several tables in database and translate my DSL into SQL statements for query. Since one DSL statement may be mapped to several SQL statements, it's better to push the DSL server as close to the PG server as possible. I found PG's backgroud worker meet my needs. I can setup a background worker bounded to PG server and listen to a port for network requests.
But I encounter a problem that the Server Programing Interfaces are not THREAD SAFE. There are some global variables defined like: SPI_processed, SPI_tuptable, etc. This limit to my DSL server to work in single thread mode which is quite inefficient. So my questions are:
1. Is there a way to use SPI in multi-thread style?
2. Another option is to use libpq, like normal clients do. Is libpq as efficient as SPI?
Thanks in advance!
Xiafei Qiu