Re: Plan weirdness. A sort produces more rows than the node beneath it

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dane Foster <studdugie(at)gmail(dot)com>
Cc: psql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Plan weirdness. A sort produces more rows than the node beneath it
Date: 2023-08-04 15:31:57
Message-ID: 3661332.1691163117@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dane Foster <studdugie(at)gmail(dot)com> writes:
>> If the sort is the inner input to a merge join, this could reflect
>> mark-and-restore rescanning of the sort's output. Are there a
>> whole lot of duplicate keys on the merge's other side?

> Yes. The course_id column's values repeat a LOT on the merge side.

Hmm. The planner should avoid using a merge join if it knows that
to be true. Maybe analyze'ing that table would prompt it to use
some other join method?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dane Foster 2023-08-04 16:41:28 Re: Plan weirdness. A sort produces more rows than the node beneath it
Previous Message Dane Foster 2023-08-04 15:15:40 Re: Plan weirdness. A sort produces more rows than the node beneath it