Re: scalability bottlenecks with (many) partitions (and more)

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: scalability bottlenecks with (many) partitions (and more)
Date: 2024-09-05 17:21:01
Message-ID: 14cd8763-c905-4705-99c5-cbcc5db06f50@vondra.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Here's a bit more polished version of this patch series. I only propose
0001 and 0002 for eventual commit, the two other bits are just stuff to
help with benchmarking etc.

0001
----
increases the size of the arrays, but uses hard-coded number of groups
(64, so 1024 locks) and leaves everything in PGPROC

0002
----
Allocates that separately from PGPROC, and sets the number based on
max_locks_per_transactions

I think 0001 and 0002 should be in fairly good shape, IMO. There's a
couple cosmetic things that bother me (e.g. the way it Asserts after
each FAST_PATH_LOCK_REL_GROUP seems distracting).

But other than that I think it's fine, so a review / opinions would be
very welcome.

0003
----
Adds a separate GUC to make benchmarking easier (without the impact of
changing the size of the lock table).

I think the agreement is to not have a new GUC, unless it turns out to
be necessary in the future. So 0003 was just to make benchmarking a bit
easier.

0004
----
This was a quick attempt to track the fraction of fast-path locks, and
adding the infrastructure is mostly mechanical thing. But it turns out
it's not quite trivial to track why a lock did not use fast-path. It
might have been because it wouldn't fit, or maybe it's not eligible, or
maybe there's a stronger lock. It's not obvious how to count these to
help with evaluating the number of fast-path slots.

regards

--
Tomas Vondra

Attachment Content-Type Size
v20240905-0001-Increase-the-number-of-fast-path-lock-slot.patch text/x-patch 14.3 KB
v20240905-0002-Size-fast-path-slots-using-max_locks_per_t.patch text/x-patch 15.2 KB
v20240905-0003-separate-guc-to-allow-benchmarking.patch text/x-patch 4.7 KB
v20240905-0004-lock-stats.patch text/x-patch 13.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2024-09-05 17:29:44 Re: Statistics Import and Export
Previous Message Jacob Champion 2024-09-05 17:08:23 Re: Make query cancellation keys longer