On Fri, May 15, 2020 at 9:20 AM Cameron Simpson <c...@cskk.id.au> wrote:
>
> On 14May2020 22:36, Stephane Tougard <steph...@sdf.org> wrote:
> >A multithreaded software written in Python is connected with a Postgres
> >database. To avoid concurrent access issue with the database, it starts
> >a thread who receive all SQL request via queue.put and queue.get (it
> >makes only insert, so no issue with the return of the SQL request).
>
> Just a remark that PostgreSQL ets callers work in parallel, just make
> multiple connections.

Seconded. If you know how many threads you're going to have, just open
that many connections. If not, there's a connection-pooling feature as
part of psycopg2 (if I'm not mistaken). This would be far far easier
to work with than a fragile queueing setup.

Chrisa
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to