Re: Incorrect cost for MergeAppend

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Alexander Kuzmenkov <akuzmenkov(at)timescale(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incorrect cost for MergeAppend
Date: 2024-01-30 23:03:23
Message-ID: CAApHDvoNzHeMgfwPDSesJ7Tp2TzVxWS+AHAMtWrSr==HzsACmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 31 Jan 2024 at 02:23, Alexander Kuzmenkov
<akuzmenkov(at)timescale(dot)com> wrote:
>
> On Tue, Jan 30, 2024 at 1:20 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> > You should likely focus on trying to find a test that does not require
> > making 2 tables with 10k rows.
>
> Is 1k smallint OK? It should fit in one page. Still reproduces the
> error, and the entire test case runs in under 10 ms.

I had a go at making it a bit smaller without going dangerously close
to where the plan might change. The following seems to work.

create table ma0(a int primary key);
create table ma1() inherits (ma0);
insert into ma0 select generate_series(1, 400);
insert into ma1 select generate_series(1, 200);
analyze ma0;
analyze ma1;

explain (costs off) select * from ma0 where a < 100 order by a;

drop table ma0 cascade;

As for backpatching this. It does risk plans changing in stable
versions of PostgreSQL, which we normally try to avoid. However, it
seems quite similar to 1e731ed12a, albeit, far more long-standing.
I'm currently thinking we should backpatch this back to 12.

Does anyone disagree?

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-01-30 23:06:17 Re: why there is not VACUUM FULL CONCURRENTLY?
Previous Message Dave Cramer 2024-01-30 22:54:01 Re: [PATCH] Add native windows on arm64 support