Re: Postgre and AIO

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: "Weck, Luis" <luis(dot)weck(at)pismo(dot)io>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgre and AIO
Date: 2025-09-29 12:26:27
Message-ID: CAFCRh--pj5G70NsWTrJDBgBtRVug3m432vRkQ=Du6OQ4a8LH9A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 29, 2025 at 2:07 PM Weck, Luis <luis(dot)weck(at)pismo(dot)io> wrote:
> Now that AIO landed in v18,
> [...] index updating happens one at a time.
> [...] it took a long time sequentially reading the index for each value

These have nothing to do with Async-IO IMHO.

For your first case, each index is its own file, so could already be
processed in parallel, in terms of IO.

For your second case, and in general, this is about the SQL processing
engine doing more in parallel. AFAIK, because of the current (mostly?)
single-threaded-process-based architecture, parallel processing means
forking worker processes, and that's not done too often.

AIO is not a magic bullet. It just means NOT blocking waiting for IO,
so you have the opportunity to do something else during that time. But
your code must be structured to be able to do something else already.
Which is not free, and tends to make the code more complex. In
single-threaded apps, like PostgreSQL backends, that means an event
loop, and while I'm sure there's one, for the client-backend socket
IO, I'm not sure the rest of the code is loop-based.

But these are comments from someone who doesn't know the code, so feel
free to ignore :). --DD

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ray O'Donnell 2025-09-29 15:43:41 Re: PostgreSQL 18 not available for Noble?
Previous Message Xuneng Zhou 2025-09-29 12:25:46 Re: Postgre and AIO