Re: Postgresql OOM

From: Pantelis Theodosiou <ypercube(at)gmail(dot)com>
To: Radu Radutiu <rradutiu(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Postgresql OOM
Date: 2024-06-06 12:58:24
Message-ID: CAE3TBxxfzF3GpUz_tKF=+8fe0-9+C6M8Y01nnK8FpEFLtfe2WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 6, 2024 at 1:25 PM Radu Radutiu <rradutiu(at)gmail(dot)com> wrote:

> Hello all,
>
> I have a query that forces an out of memory error, where the OS will kill
> the postgresql process.
> The query plan (run immediately after a vacuum analyze) is at
> https://explain.depesz.com/s/ITQI#html .
>
> ...

>
> Any idea on how to identify the problem? I can reproduce it on demand.
> Should I report it pgsql-bugs?
>
> Best regards,
> Radu
>

I am not qualified to answer on the OOM issue but why are you joining the
same table (outputrequest) 4 times (using an identical join condition)?
This essentially does a cross join, if an input_sequence value has say,
1000 related rows in outputrequest, you will be getting 1000^4 rows in the
result set.

FROM inputrequest t
LEFT JOIN outputrequest rec_tro
ON rec_tro.input_sequence = t.input_sequence
LEFT JOIN inputrequest r
ON r.originalRequest_id = t.input_sequence
LEFT JOIN outputrequest rpl_rec_tro
ON rpl_rec_tro.input_sequence = r.input_sequence
LEFT JOIN outputrequest rpl_snd_tro
ON rpl_snd_tro.reply_input_sequence = r.input_sequence
LEFT JOIN outputrequest snd_tro
ON snd_tro.reply_input_sequence = t.input_sequence

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-06-06 13:27:44 Re: How about using dirty snapshots to locate dependent objects?
Previous Message Julien Tachoires 2024-06-06 12:51:56 Re: Compress ReorderBuffer spill files using LZ4