[GENERAL] Is is safe to use SPI in multiple threads?

Поиск
Список
Период
Сортировка
От Qiu Xiafei
Тема [GENERAL] Is is safe to use SPI in multiple threads?
Дата
Msg-id CA+ag+4PGWbnHQx35Hswmd0aeMg8LkH5HTwApPtEwuGv=EJKUXA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GENERAL] Is is safe to use SPI in multiple threads?
Re: [GENERAL] Is is safe to use SPI in multiple threads?
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas.Deboben.ext@rohde-schwarz.com
Дата:
Сообщение: [GENERAL] Windows installation - could not connect to server: Connectionrefused (0x0000274D/10061)
Следующее
От: Johann Spies
Дата:
Сообщение: Re: [GENERAL] After upgrade to 9.6: waiting column does not exist