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

Avoid projection more often in DecompressChunk node #6859

Merged
merged 18 commits into from
May 29, 2024

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented Apr 24, 2024

Currently its scan targetlist is always the uncompressed tuple, but in some cases we can make the scan targetlist the same as the required output targetlist, thus avoiding the projection.

This is required to enable vectorized aggregation in more cases, but is also a performance improvement in itself. In tsbench, it gives up to 25% speedup for some queries: https://grafana.ops.savannah-dev.timescale.com/d/fasYic_4z/compare-akuzm?orgId=1&var-branch=All&var-run1=3461&var-run2=3469&var-threshold=0&var-use_historical_thresholds=true&var-threshold_expression=2.5%20%2A%20percentile_cont%280.90%29&var-exact_suite_version=false&from=now%2Fy&to=now%2Fy

This partially implements https://github.com/timescale/eng-database/issues/564

Disable-check: force-changelog-file

Currently its scan targetlist is always the uncompressed tuple, but in
some cases we can make the scan targetlist the same as the output
targetlist, thus avoiding the projection.
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

Attention: Patch coverage is 87.40741% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 81.74%. Comparing base (59f50f2) to head (03faf9c).
Report is 185 commits behind head on main.

Files Patch % Lines
tsl/src/nodes/decompress_chunk/planner.c 91.57% 0 Missing and 8 partials ⚠️
tsl/src/nodes/decompress_chunk/exec.c 75.00% 1 Missing and 3 partials ⚠️
tsl/src/nodes/decompress_chunk/compressed_batch.c 80.00% 0 Missing and 2 partials ⚠️
tsl/src/nodes/vector_agg/plan.c 83.33% 0 Missing and 2 partials ⚠️
tsl/src/nodes/vector_agg/exec.c 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6859      +/-   ##
==========================================
+ Coverage   80.06%   81.74%   +1.67%     
==========================================
  Files         190      199       +9     
  Lines       37181    36942     -239     
  Branches     9450     9654     +204     
==========================================
+ Hits        29770    30198     +428     
+ Misses       2997     2862     -135     
+ Partials     4414     3882     -532     

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

@akuzm akuzm marked this pull request as ready for review May 2, 2024 18:49
Copy link
Contributor

@antekresic antekresic left a comment

Choose a reason for hiding this comment

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

Pre-approving with request to add a testcase.

Var *var = castNode(Var, node);
if (var->varno != OUTER_VAR)
Var *aggregated_var = castNode(Var, node);
if (aggregated_var->varno != OUTER_VAR)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test to cover this branch as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it just can't happen, I'll change it to an assertion.

tsl/src/nodes/decompress_chunk/planner.c Outdated Show resolved Hide resolved
akuzm and others added 3 commits May 29, 2024 11:47
Co-authored-by: Ante Kresic <antekresic@users.noreply.github.com>
Signed-off-by: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com>
@akuzm akuzm enabled auto-merge (squash) May 29, 2024 10:10
@akuzm akuzm merged commit 442e536 into timescale:main May 29, 2024
39 of 40 checks passed
@akuzm akuzm deleted the decompress-project branch May 29, 2024 10:10
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.

None yet

3 participants