| From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
|---|---|
| To: | "Arseniy Mukhin" <arseniy(dot)mukhin(dot)dev(at)gmail(dot)com>, "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com>, "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Optimize LISTEN/NOTIFY |
| Date: | 2025-11-05 01:06:54 |
| Message-ID: | 956ecc50-b0af-4865-be1f-97b082cb6b1f@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Nov 5, 2025, at 01:58, Joel Jacobson wrote:
> Changes since v22:
>
> * Optimize listening on thousands of channels per backend by replacing
> the listenChannels List with a local hash table, renamed to
> listenChannelsHash to avoid confusion.
I forgot to say that this is per idea from Heikki in the other thread [1]:
"The elephant in the room of course is that a lookup in a linked list is
O(n) and it would be very straightforward to replace it with e.g. a hash
table. We should do that irrespective of this bug fix. But I'm inclined
to do it as a separate followup patch."
[1] https://www.postgresql.org/message-id/66213fee-00ff-4952-802d-c06454e521ac%40iki.fi
> * Removed advisoryPos, since it was not actually used. We only needed
> advancingPos to fix the bug with truncation of the queue. It's possible
> that the bottleneck in some workloads is no longer the wakeups, but I'm
> not sure yet; I'll do some more benchmarking to get a better
> understanding of whether it would be worthwhile to pursue further
> optimization.
>
> * Removed asyncQueuePageDiff, since it's no longer used.
/Joel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joel Jacobson | 2025-11-05 01:10:45 | Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue |
| Previous Message | Joel Jacobson | 2025-11-05 00:58:23 | Re: Optimize LISTEN/NOTIFY |