Re: Out of Memory errors are frustrating as heck!

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Gunther <raj(at)gusw(dot)net>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Out of Memory errors are frustrating as heck!
Date: 2019-04-20 07:52:57
Message-ID: 20190420075257.GA4323@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Apr 19, 2019 at 11:34:54PM -0400, Gunther wrote:
> On 4/19/2019 17:01, Justin Pryzby wrote:
> >Were you able to reproduce the issue in some minimized way ? Like after
> >joining fewer tables or changing to join with fewer join conditions ?
> >
> >On Thu, Apr 18, 2019 at 05:21:28PM +0200, Tomas Vondra wrote:
> >>It would be possible to do at least one of these two things:
>
> Thanks, and sorry for my pushyness. Yes, I have pin pointed the HashJoin,
> and I have created the two tables involved.
>
> The data distribution of the join keys, they are all essentially UUIDs and
> essentially random.
>
> I am sharing this data with you. However, only someone who can actually
> control the planner can use it to reproduce the problem. I have tried but
> not succeeded. But I am sure the problem is reproduced by this material.
>
> Here is the part of the plan that generates this massive number of calls to
>
> -> Hash Right Join (cost=4255031.53..5530808.71 rows=34619 width=1197)
> Hash Cond: (((q.documentinternalid)::text = (documentinformationsubject.documentinternalid)::text) AND ((r.targetinternalid)::text = (documentinformationsubject.actinternalid)::text))
> -> Hash Right Join (cost=1341541.37..2612134.36 rows=13 width=341)
> Hash Cond: (((documentinformationsubject_2.documentinternalid)::text = (q.documentinternalid)::text) AND ((documentinformationsubject_2.actinternalid)::text = (q.actinternalid)::text))
> ... let's call this tmp_q ...
> -> Hash (cost=2908913.87..2908913.87 rows=34619 width=930)
> -> Gather Merge (cost=2892141.40..2908913.87 rows=34619 width=930)
> ... let's call this tmp_r ...

Would you send basic stats for these ?
q.documentinternalid, documentinformationsubject.documentinternalid, r.targetinternalid, documentinformationsubject.actinternalid

Like from this query
https://wiki.postgresql.org/wiki/Slow_Query_Questions#Statistics:_n_distinct.2C_MCV.2C_histogram

Justin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2019-04-20 10:53:36 Re: Out of Memory errors are frustrating as heck!
Previous Message Jeremy Schneider 2019-04-20 05:54:13 Re: Out of Memory errors are frustrating as heck!