Re: [HACKERS] multithreading in Batch/pipelining mode for libpq

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: [HACKERS] multithreading in Batch/pipelining mode for libpq
Дата
Msg-id CAMsr+YFcoWm6WuhXvs6FGMsOWez3VdkfuJ4xzBd5ok3VBmhW3Q@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] multithreading in Batch/pipelining mode for libpq  (Ilya Roublev <iroublev@gmail.com>)
Ответы Re: [HACKERS] multithreading in Batch/pipelining mode for libpq
Список pgsql-hackers


On 22 Apr. 2017 6:04 am, "Ilya Roublev" <iroublev@gmail.com> wrote:

1) is it possible technically (possibly by changing some part of libpq code) to ignore results (especially for this sort of queries like insert), processing somehow separately the situation when some error occurs? 

There is a patch out there to allow libpq result processing by callback I think. Might be roughly what you want.

2) if the answer to the previous question is negative, is it possible to send asynchronous queries in one thread while reading results in another thread?

Not right now. libpq's state tracking wouldn't cope.

I imagine it could be modified to work with some significant refactoring. You'd need to track state with a shared fifo of some kind where dispatch outs queries on the fifo as it sends them and receive pops them from it.

I started on that for the batch mode stuff but it's not in any way thread safe there.
 

 locking, info in PGconn very quickly becomes inconsistent, the number of queries sent does not correspond to the number of results to be read, etc. So I'd like to know at first is it possible at all (possibly by some changes to be made in libpq)? Sorry if my idea sounds rather naive. And thanks for your answer and advice. 

Yeah, it's possible. The protocol can handle it, it's just libpq that can't.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Unportable implementation of background worker start
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] multithreading in Batch/pipelining mode for libpq