Skip to content

Use ColumnarIndexScan for ORDER BY LIMIT 1 queries - #10476

Open
svenklemm wants to merge 1 commit into
mainfrom
sven/cis_orderby_limit
Open

Use ColumnarIndexScan for ORDER BY LIMIT 1 queries#10476
svenklemm wants to merge 1 commit into
mainfrom
sven/cis_orderby_limit

Conversation

@svenklemm

Copy link
Copy Markdown
Member

Create ColumnarIndexScan paths for eligible queries when all required
columns can be reconstructed from segment-by columns and sparse
order-by metadata. This allows boundary rows to be returned without
decompressing batches.

Extend the plan and executor output mapping to support projected scan
paths as well as aggregate rewrites. Only select the optimization when
all qualifications are pushed down and no decompression recheck is
required.

@github-actions

Copy link
Copy Markdown

@natalya-aksman, @dbeck: please review this pull request.

Powered by pull-review

Create ColumnarIndexScan paths for eligible queries when all required
columns can be reconstructed from segment-by columns and sparse
order-by metadata. This allows boundary rows to be returned without
decompressing batches.

Extend the plan and executor output mapping to support projected scan
paths as well as aggregate rewrites. Only select the optimization when
all qualifications are pushed down and no decompression recheck is
required.
@svenklemm
svenklemm force-pushed the sven/cis_orderby_limit branch from 67f4f7f to 5638367 Compare August 30, 2026 09:23
}

static bool
columnar_index_scan_query_supported(PlannerInfo *root)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is columnar index scan planning is now in columnar scan planning? Shouldn't we keep them separate?


static CustomPathMethods columnar_index_scan_path_methods = {
.CustomName = COLUMNAR_INDEX_SCAN_NAME,
.PlanCustomPath = columnar_index_scan_plan_path,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you decide to switch to cost-based planning for columnar index scan? Isn't it still absolutely better when applicable? I liked that we could skip the cost-based planning for it, because this requires less code and makes planning faster.

List *targetlist, List *custom_scan_tlist,
List *exec_output_map, int flags);
extern Node *columnar_index_scan_state_create(CustomScan *cscan);
extern Plan *try_insert_columnar_index_scan_node(Plan *plan, List *rtable);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you also keeping the old planning metod in addition to the new planning method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants