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