From 46846433a03dff4f2e08c8a161e54a842da360d6 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 14 Oct 2021 16:06:43 -0400 Subject: shm_mq: Update mq_bytes_written less often. Do not update shm_mq's mq_bytes_written until we have written an amount of data greater than 1/4th of the ring size, unless the caller of shm_mq_send(v) requests a flush at the end of the message. This reduces the number of calls to SetLatch(), and also the number of CPU cache misses, considerably, and thus makes shm_mq significantly faster. Dilip Kumar, reviewed by Zhihong Yu and Tomas Vondra. Some minor cosmetic changes by me. Discussion: http://postgr.es/m/CAFiTN-tVXqn_OG7tHNeSkBbN+iiCZTiQ83uakax43y1sQb2OBA@mail.gmail.com --- src/backend/executor/tqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/executor') diff --git a/src/backend/executor/tqueue.c b/src/backend/executor/tqueue.c index 7af9fbe9848..eb0cbd7b217 100644 --- a/src/backend/executor/tqueue.c +++ b/src/backend/executor/tqueue.c @@ -60,7 +60,7 @@ tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self) /* Send the tuple itself. */ tuple = ExecFetchSlotMinimalTuple(slot, &should_free); - result = shm_mq_send(tqueue->queue, tuple->t_len, tuple, false); + result = shm_mq_send(tqueue->queue, tuple->t_len, tuple, false, false); if (should_free) pfree(tuple); -- cgit v1.2.3