Re: O(N^3) planning time in choose_plan_name() since 8c49a484e8e

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Haas <rhaas(at)postgresql(dot)org>
Subject: Re: O(N^3) planning time in choose_plan_name() since 8c49a484e8e
Date: 2026-10-30 04:03:47
Message-ID: 179333302790.1567246.12539038338733489254@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ayoub,

On Fri, Oct 30, 2026 at 2:57 AM Ayoub Kazar <ayoub(dot)kazar(at)data-bene(dot)io>
wrote:
> One small suggestion: the suffix parsing in subplan_name_in_use() scans
> the digits
> multiple times across strspn, strlen, and strtoul. It might be a bit cleaner
> to fold the validation and conversion together into a single pass.

Thanks, that reads better. Done in v3, attached. The length cap goes
too: next_suffix is an unsigned, and strtoul saturates instead of
wrapping, so a longer suffix never comes out below it.

Regards,
Manu

Attachment Content-Type Size
v3-0001-Avoid-O-N-3-planning-time-in-choose_plan_name.patch text/x-patch 9.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Suraj Kharage 2026-10-30 04:40:09 psql: tab completion offers invalid COPY option values
Previous Message Manu 2026-10-30 03:37:20 Re: Allow progress tracking of sub-commands