Precheck to consider path costs for partial paths

From: Nikita Malakhov <hukutoc(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Precheck to consider path costs for partial paths
Date: 2024-12-03 18:24:37
Message-ID: CAN-LCVNxj_AyBWzyxx6uYc7SLkRgLirWbJQzZx_pgd_tLXZh=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers!

I'd stumbled upon the discussion [1] on TPC-DS query performance,
looked into code that caused this behavior and saw that partial hash,
merge and nested loop paths are discarded regardless of costs
if they have more pathkeys.

I've excluded the pathkey chain length condition from the precheck function
and added passing precalculated startup cost in addition to total cost,
and it seems to produce a more effective plan for case in [1].

Please check the attached patch. I'm very interested if my assumption
is correct or not.

[1]
https://www.postgresql.org/message-id/flat/SEZPR06MB649422CDEBEBBA3915154EE58A232%40SEZPR06MB6494.apcprd06.prod.outlook.com

--
Regards,
Nikita Malakhov
Postgres Professional
The Russian Postgres Company
https://postgrespro.ru/

Attachment Content-Type Size
v1-0001-ppath-precheck.patch application/octet-stream 4.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rahila Syed 2024-12-03 19:09:02 Re: Enhancing Memory Context Statistics Reporting
Previous Message Robert Haas 2024-12-03 18:04:29 Re: Windows pg_basebackup unable to create >2GB pg_wal.tar tarballs ("could not close file: Invalid argument" when creating pg_wal.tar of size ~ 2^31 bytes)