-
Notifications
You must be signed in to change notification settings - Fork 914
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
base: main
Are you sure you want to change the base?
Conversation
6243347
to
68455b7
Compare
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.
68455b7
to
df5440a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable.
@akuzm, @gayyappan: please review this pull request.
|
/* | ||
* 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.