Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove costing index scan of hypertable parent #7768

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .unreleased/pr_7768
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes: #7768 Remove costing index scan of hypertable parent
13 changes: 13 additions & 0 deletions src/planner/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,19 @@ timescaledb_set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rti, Rang
#endif
TS_FALLTHROUGH;
default:
/*
* Set the indexlist for a hypertable parent to NIL since we
* should not try to do any index scans on hypertable parents,
* similar to how it works for partitioned tables.
Copy link
Member

Choose a reason for hiding this comment

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

Is this something that Postgres does for partitioned tables?? If yes then would be good to point to the postgres source code here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is done inside get_actual_variable_range, which is mentioned last in the paragraph.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... well, later in the paragraph, not last.

*
* This can happen when building a merge join path and computing
* cost for it. See get_actual_variable_range().
*
* This has to be after the hypertable is expanded, since the
* indexlist is used during hypertable expansion.
*/
if (reltype == TS_REL_HYPERTABLE)
rel->indexlist = NIL;
apply_optimizations(root, reltype, rel, rte, ht);
break;
}
Expand Down
Loading