MergeAppend could consider sorting cheapest child path

From: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: MergeAppend could consider sorting cheapest child path
Date: 2024-06-18 16:45:09
Message-ID: 25d6a2cd161673d51373b7e07e6d9dd6@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Now when planner finds suitable pathkeys in
generate_orderedappend_paths(), it uses them, even if explicit sort of
the cheapest child path could be more efficient.

We encountered this issue on partitioned table with two indexes, where
one is suitable for sorting, and another is good for selecting data.
MergeAppend was generated
with subpaths doing index scan on suitably ordered index and filtering a
lot of data.
The suggested fix allows MergeAppend to consider sorting on cheapest
childrel total path as an alternative.

--
Best regards,
Alexander Pyhalov,
Postgres Professional

Attachment Content-Type Size
v1-0001-MergeAppend-could-consider-using-sorted-best-path.patch text/x-diff 15.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2024-06-18 16:49:36 Re: Reducing the log spam
Previous Message Bruce Momjian 2024-06-18 16:32:49 Re: PostgreSQL 17 Beta 2 release date & commit freeze