pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Samuel Williams <space.ship.traveller@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: libpq read/write
Date: Sat, 30 Mar 2019 10:17:14 -0400
Message-ID: <19687.1553955434@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHkN8V_zTfF9QAwG_rrM=k6U56xvnEyNsUDi9_=vOg7UZHgF_A@mail.gmail.com>
References: <CAHkN8V_zTfF9QAwG_rrM=k6U56xvnEyNsUDi9_=vOg7UZHgF_A@mail.gmail.com>

Samuel Williams <space.ship.traveller@gmail.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





view thread (3+ messages)  latest in thread

Message-ID: <19687.1553955434@sss.pgh.pa.us>
Permalink:  ../19687.1553955434@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19687.1553955434@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, space.ship.traveller@gmail.com
  Subject: Re: libpq read/write
  In-Reply-To: <19687.1553955434@sss.pgh.pa.us>
  References: <CAHkN8V_zTfF9QAwG_rrM=k6U56xvnEyNsUDi9_=vOg7UZHgF_A@mail.gmail.com> <19687.1553955434@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox