Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: Andrei Lepikhov <lepihov(at)gmail(dot)com>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
Date: 2024-10-10 10:20:36
Message-ID: CAMbWs4-tqttBrw5nOtQ0e=PPW5nO-k9gSk6MmNkfbfZfGph-vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 10, 2024 at 5:02 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> Andrei Lepikhov <lepihov(at)gmail(dot)com> 于2024年10月10日周四 14:50写道:
>> Looking into that case, I don't understand only one thing:
>> generate_orderedappend_paths decided to try MergeAppend; the
>> create_append_path routine added the Sort cost, but the Sort node
>> itself wasn't added. Maybe the origin problem is the lack of feasibility
>> examinations?

> Yeah, I'm also curious why only cost Sort but not adding Sort node in create_merge_append_path().
> The comments say that " We'll need to insert a Sort node, so include cost for that". Does another place
> insert the Sort node?

The Sort node will be added in createplan.c. This isn't exclusive to
MergeAppend; we also do so for MergeJoin, for example.

Thanks
Richard

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrei Lepikhov 2024-10-10 10:23:40 Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
Previous Message Tender Wang 2024-10-10 09:02:16 Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index