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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkindahl
Copy link
Contributor

When computing cost for a merge join path, an index scan will be done on the relation to find the actual variable range using get_actual_variable_range(), which will include an index scan of the hypertable parent.

In addition to being unneccessary, it can also cause problems in situations where the hypertable parent contains data as a result of a bug.

There is a check that an index scan is not done for a partitioned table, so we do the same here by setting the indexlist to NIL after hypertable expansion. The index list is needed while expanding the hypertables to construct correct index scans for chunks of a hypertable.

@mkindahl mkindahl self-assigned this Feb 21, 2025
When computing cost for a merge join path, an index scan will be done
on the relation to find the actual variable range using
`get_actual_variable_range()`, which will include an index scan of the
hypertable parent.

In addition to being unneccessary, it can also cause problems in
situations where the hypertable parent contains data as a result of a
bug.

There is a check that an index scan is not done for a partitioned
table, so we do the same here by setting the indexlist to NIL after
hypertable expansion. The index list is needed while expanding the
hypertables to construct correct index scans for chunks of a
hypertable.
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.89%. Comparing base (59f50f2) to head (df5440a).
Report is 788 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7768      +/-   ##
==========================================
+ Coverage   80.06%   81.89%   +1.82%     
==========================================
  Files         190      247      +57     
  Lines       37181    45432    +8251     
  Branches     9450    11356    +1906     
==========================================
+ Hits        29770    37205    +7435     
- Misses       2997     3749     +752     
- Partials     4414     4478      +64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@erimatnor erimatnor left a comment

Choose a reason for hiding this comment

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

Seems reasonable.

@mkindahl mkindahl marked this pull request as ready for review February 21, 2025 14:55
@github-actions github-actions bot requested review from akuzm and gayyappan February 21, 2025 14:56
Copy link

@akuzm, @gayyappan: please review this pull request.

Powered by pull-review

/*
* 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
Contributor

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.

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

Successfully merging this pull request may close these issues.

3 participants