Re: BUG #19881: CLUSTER uses a disabled sort path when enable_sort is off

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, imchifan8(at)gmail(dot)com
Subject: Re: BUG #19881: CLUSTER uses a disabled sort path when enable_sort is off
Date: 2026-11-21 02:28:31
Message-ID: CAHGQGwGhA-tzFGPV+oBQF1jK==tSkmwM=z_z9p+bhb-yYCAzLA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Nov 21, 2026 at 2:12 AM Raja Sai pranav
<rajasaipranav0(at)gmail(dot)com> wrote:
> The patch uses compare_path_costs(), which looks at disabled nodes first, like the rest of the planner.

Thanks for the patch!

There seems another related issue: enable_seqscan = off still has no effect,
even with this patch. The cause seems to be that plan_cluster_use_sort()
leaves glob->default_pgs_mask at zero, effectively disabling both scan types.

We should initialize the default_pgs_mask before calling build_simple_rel()?
For example:

-------------------------------
glob = makeNode(PlannerGlobal);

+ glob->default_pgs_mask = PGS_CONSIDER_NONPARTIAL | PGS_INDEXSCAN;
+ if (enable_seqscan)
+ glob->default_pgs_mask |= PGS_SEQSCAN;
-------------------------------

This fix seems necessary for both v19 and master.

BTW, separately, I found that the CLUSTER/REPACK docs mention only
enable_sort, although enable_seqscan and enable_indexscan also affect
the choice. Perhaps we could document those in a separate patch.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Raja Sai pranav 2026-11-21 06:00:07 Re: BUG #19881: CLUSTER uses a disabled sort path when enable_sort is off
Previous Message Tom Lane 2026-11-21 02:24:58 Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance