Re: Issues Scaling Postgres Concurrency - Mailing list pgsql-general

From Tom Lane
Subject Re: Issues Scaling Postgres Concurrency
Date
Msg-id 3012913.1678834623@sss.pgh.pa.us
Whole thread Raw
In response to Re: Issues Scaling Postgres Concurrency  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
List pgsql-general
"Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> On 2023-03-14 22:47:43 +0100, Laurenz Albe wrote:
>> A query that counts the number of rows in a table of half a million
>> rows is quite expensive and keeps a CPU core busy for a while
>> (provided everything is cached). At some degree of parallelism, your
>> CPU is overloaded, which leads to non-linear slowdown.

> The interesting thing is that on my laptop even two concurrent accesses
> cause a 100% slowdown. I think this is because the task is actually
> memory-bound: The cores may do the counting in parallel, but they have
> to read the data from the same RAM (since it's too large to fit in the
> CPU cache) and they have to take turns accessing it.

I wondered if synchronize_seqscans might exacerbate this behavior by
encouraging more cores to be touching the same buffers at the same time.
I couldn't measure much difference between having it on vs. off in a
pgbench test with all the clients counting the same table ... but maybe
on other hardware the effect would show up.

            regards, tom lane



pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: Issues Scaling Postgres Concurrency
Next
From: Bryn Llewellyn
Date:
Subject: Is the PL/pgSQL refcursor useful in a modern three-tier app?