Re: Outer cost higher than the inner cost

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stanisław Skonieczny <stanislaw(dot)skonieczny(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Outer cost higher than the inner cost
Date: 2024-07-26 14:30:47
Message-ID: 1676226.1722004247@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?UTF-8?Q?Stanis=C5=82aw_Skonieczny?= <stanislaw(dot)skonieczny(at)gmail(dot)com> writes:
> What bothers me is that the inner plan cost (7430940) is higher than the
> outer plan cost (1131699).

I think it is estimating (based on knowledge of the ranges of join keys
in the two relations) that that input subplan won't need to be run to
completion. See initial_cost_mergejoin in costsize.c.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Laurenz Albe 2024-07-27 14:19:23 Re: proposal: schema variables
Previous Message Stanisław Skonieczny 2024-07-26 13:25:44 Outer cost higher than the inner cost