Re: libpq read/write

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Samuel Williams <space(dot)ship(dot)traveller(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: libpq read/write
Date: 2019-03-30 14:17:14
Message-ID: 19687.1553955434@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Samuel Williams <space(dot)ship(dot)traveller(at)gmail(dot)com> writes:
> I've been doing some profiling and I was surprised to see that libpq uses
> epoll when handling what essentially amounts to blocking reads/writes.

Yup.

> I was just wondering why it needed to be so complicated?

So that we can also support nonblocking behavior (cf PQisBusy).

If the library were being written from scratch today, I doubt anybody
would bother with that; it'd make more sense for an application to
use a separate thread for the database interaction, if there were
other things it needed to pay attention to concurrently. But it is
what it is.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Steele 2019-03-30 15:03:04 Re: Regarding pgaudit log_directory
Previous Message Adrian Klaver 2019-03-30 13:53:43 Re: Required postgreSQL 10.4 version for Suse enterprise