Search Postgresql Archives

Is is safe to use SPI in multiple threads?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux