-
Notifications
You must be signed in to change notification settings - Fork 848
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
Improved parallel DecompressChunk worker selection #5870
Conversation
e248784
to
267a239
Compare
Codecov Report
@@ Coverage Diff @@
## main #5870 +/- ##
==========================================
+ Coverage 87.08% 87.09% +0.01%
==========================================
Files 243 243
Lines 55917 55877 -40
Branches 12377 12359 -18
==========================================
- Hits 48694 48666 -28
+ Misses 4894 4858 -36
- Partials 2329 2353 +24
... and 36 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
6054cd3
to
2122b26
Compare
65d1a9b
to
023c494
Compare
@@ -2,7 +2,7 @@ | |||
-- Please see the included NOTICE for copyright information and | |||
-- LICENSE-APACHE for a copy of the license. | |||
|
|||
SELECT * FROM compress ORDER BY time DESC, small_cardinality; | |||
SELECT * FROM compress ORDER BY time DESC, small_cardinality, large_cardinality, some_double, some_int, some_custom, some_bool; |
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.
Test output was not deterministic so far.
@RafiaSabih, @fabriziomello: please review this pull request.
|
@@ -1572,7 +1572,23 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, Comp | |||
|
|||
/* create parallel scan path */ | |||
if (compressed_rel->consider_parallel) | |||
ts_create_plain_partial_paths(root, compressed_rel); | |||
{ |
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.
Since this is the only caller for ts_create_plain_partial_paths we should either move the code into that function or get rid of the function
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.
The function is still called in set_plain_rel_pathlist()
. However, it is used only in non-TSL code. So, I removed the export of the function.
023c494
to
587ada9
Compare
src/import/allpaths.c
Outdated
static void | ||
create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel) | ||
{ |
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.
This is a matter of taste, but I would still leave the ts_ prefix so that it's harder to confuse with grep/go to definition.
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.
Changed back to ts_create_plain_partial_paths
as suggested.
@@ -17,7 +17,7 @@ WHERE | |||
hypertable.table_name = 'compress' | |||
AND chunk.compressed_chunk_id IS NULL; | |||
|
|||
SELECT * FROM compress ORDER BY time DESC, small_cardinality; | |||
SELECT * FROM compress ORDER BY time DESC, small_cardinality, large_cardinality, some_double, some_int, some_custom, some_bool; |
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.
ORDER BY compress
would order by all columns.
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.
We have to use the same ordering as the existing up/downgrade tests to generate the same output. Otherwise, the tests will fail. Therefore, we need an ordering of time DESC
and large_cardinality ASC
. I think that is not possible with the proposed change.
587ada9
to
27ab266
Compare
@jnidzwetzki , |
This PR improves the way the number of parallel workers for the DecompressChunk node are calculated. Since 1a93c2d, no partial paths for small relations are generated, which could cause a fallback to a sequential plan and a performance regression. This patch ensures that for all relations, a partial path is created again.
27ab266
to
8600266
Compare
@shhnwz The PR is now rebased |
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.
Looks Good To Me.
This PR improves the way the number of parallel workers for the DecompressChunk node are calculated. Since
1a93c2d, no partial paths for small chunks are generated, which could cause a fallback to a sequential plan and a performance regression. This patch ensures that a partial path is created again to get the 2.11.x behavior back.
Disable-check: force-changelog-file
Benchmarks
Tsbench against the last commit before this PR: https://grafana.ops.savannah-dev.timescale.com/d/NdmLnOk4z/compare-benchmark-runs?orgId=1&var-branch=All&var-run1=2549&var-run2=2551&var-threshold=0.02
Tsbench against 2.11.1 (a version without the commit 1a93c2d): https://grafana.ops.savannah-dev.timescale.com/d/NdmLnOk4z/compare-benchmark-runs?orgId=1&var-branch=All&var-run1=2514&var-run2=2551&var-threshold=0.02
Note: Disabling parallel plans for some queries might be beneficial. For example, when
ht_chunk_compressed_2k
is processed. Using this table, we have a lot of small chunks, and we have a huge overhead by the parallel logic. Here, we see some regression compared to the last commit but almost the same execution times as for 2.11.1.Planner regression
Another result from benchmarking: it seems we have some kind of planner regression introduced in ecc1b7b. It is hidden on the tsbench dashboards due to some missing commits in tsbench and the fact this particular query becomes faster when it is executed sequentially. So, we have the planner regression which is compensated by the sequentially executed query. This should be addressed in a follow-up PR.
Commit ecc1b7b
Before (d6030a3)
Differential Flame Graphs
Differential Flame Graphs for the query and the commits d6030a3 and ecc1b7b
Tsbench run
https://grafana.ops.savannah-dev.timescale.com/d/NdmLnOk4z/compare-benchmark-runs?orgId=1&var-branch=main&var-run1=2620&var-run2=2621&var-threshold=0.02