Re: Extremely inefficient merge-join - Mailing list pgsql-performance

From Tom Lane
Subject Re: Extremely inefficient merge-join
Date
Msg-id 3610142.1616014055@sss.pgh.pa.us
Whole thread Raw
In response to Extremely inefficient merge-join  (Marcin Gozdalik <gozdal@gmail.com>)
Responses Re: Extremely inefficient merge-join  (Marcin Gozdalik <gozdal@gmail.com>)
List pgsql-performance
Marcin Gozdalik <gozdal@gmail.com> writes:
> Sometimes Postgres will choose very inefficient plan, which involves
> looping many times over same rows, producing hundreds of millions or
> billions of rows:

Yeah, this can happen if the outer side of the join has a lot of
duplicate rows.  The query planner is aware of that effect and will
charge an increased cost when it applies, so I wonder if your
statistics for the tables being joined are up-to-date.

            regards, tom lane



pgsql-performance by date:

Previous
From: Marcin Gozdalik
Date:
Subject: Extremely inefficient merge-join
Next
From: Marcin Gozdalik
Date:
Subject: Re: Extremely inefficient merge-join