pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Issues Scaling Postgres Concurrency
Date: Tue, 14 Mar 2023 18:57:03 -0400
Message-ID: <3012913.1678834623@sss.pgh.pa.us> (raw)
In-Reply-To: <20230314220505.wfrbnflrdealumyg@hjp.at>
References: <CA+gH7FFqADdxMTwh1DWMM53XeAzu3TjL80DEV28baAvtctSwdw@mail.gmail.com>
	<b64a4d9fbc2ed8604886ba7994629f708c7d4e00.camel@cybertec.at>
	<20230314220505.wfrbnflrdealumyg@hjp.at>

"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





view thread (6+ messages)

Message-ID: <3012913.1678834623@sss.pgh.pa.us>
Permalink:  ../3012913.1678834623@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3012913.1678834623@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, hjp-pgsql@hjp.at
  Subject: Re: Issues Scaling Postgres Concurrency
  In-Reply-To: <3012913.1678834623@sss.pgh.pa.us>
  References: <CA+gH7FFqADdxMTwh1DWMM53XeAzu3TjL80DEV28baAvtctSwdw@mail.gmail.com> <b64a4d9fbc2ed8604886ba7994629f708c7d4e00.camel@cybertec.at> <20230314220505.wfrbnflrdealumyg@hjp.at> <3012913.1678834623@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