Re: Logical Replica ReorderBuffer Size Accounting Issues

From: Alex Richman <alexrichman(at)onesignal(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Niels Stevens <niels(dot)stevens(at)onesignal(dot)com>
Subject: Re: Logical Replica ReorderBuffer Size Accounting Issues
Date: 2023-01-06 16:35:30
Message-ID: CAMnUB3qVvWazGHxtC1emxEaTnU28N+CznabVRMbqfNQq9kf9fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Do you have any sample data to confirm
> this? If you can't share sample data, can you let us know the average
> tuple size?
>

I suspect the writes are updates to jsonb columns. I can correlate bursts
of writes of this form to the memory spikes:
UPDATE suspect_table
SET jsonb_column = jsonb_column || $1,
updated_at = $2
WHERE ...

The update being added in $1 is typically a single new field. The jsonb
column is flat string key/value pairs, e.g. lots of {"key": "value", ...}.

The average size of the whole tuple in the suspect table is ~800 bytes
(based on 10000 random samples), of which the jsonb column is 80%.

I have been trying to break into a walsender to inspect some tuple bufs
directly and compare the ChangeSize vs GetTupleBuf size as you suggest, but
it's proving a little tricky - I'll let you know if I have any luck here.

Thanks,
- Alex.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-01-06 17:53:07 Re: BUG #17717: Regression in vacuumdb (15 is slower than 10/11 and possible memory issue)
Previous Message Alex Richman 2023-01-06 15:19:49 Re: Segfault while creating logical replication slots on active DB 14.6-1 + 15.1-1