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

Optimize recompression for non-segmentby chunks #7632

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

Conversation

kpan2034
Copy link
Contributor

Enables the segmentwise recompression flow to be used for chunks without segmentby columns.

This should be more performant than doing a full recompression.

Enables the segmentwise recompression flow to be used for chunks
without segmentby columns.

This should be more performant than doing a full recompression.
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.30%. Comparing base (59f50f2) to head (5ab9b12).
Report is 718 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7632      +/-   ##
==========================================
+ Coverage   80.06%   81.30%   +1.23%     
==========================================
  Files         190      240      +50     
  Lines       37181    44696    +7515     
  Branches     9450    11159    +1709     
==========================================
+ Hits        29770    36340    +6570     
- Misses       2997     3967     +970     
+ Partials     4414     4389      -25     

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

@@ -168,6 +168,10 @@ recompress_chunk_segmentwise_impl(Chunk *uncompressed_chunk)

CompressedSegmentInfo *current_segment = palloc0(sizeof(CompressedSegmentInfo) * n_keys);

// For chunks with no segmentby settings, we can still do segmentwise recompression
// The entire chunk is treated as a single segment
elog(ts_guc_debug_compression_path_info ? INFO : DEBUG1, "using non-segmentby index for recompression") ;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will log every time that you are using non-segmentby index but thats not true. You should log the index name you are using instead (its easy to check what index is being used that way).

@@ -483,7 +483,7 @@ select compressed_chunk_name as compressed_chunk_name_after_recompression from c
select :'compressed_chunk_name_before_recompression' as before_recompression, :'compressed_chunk_name_after_recompression' as after_recompression;
before_recompression | after_recompression
----------------------------+----------------------------
compress_hyper_13_14_chunk | compress_hyper_13_15_chunk
compress_hyper_13_14_chunk | compress_hyper_13_14_chunk
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment above on line 475 needs updating since it is incorrect with this change.

@@ -291,6 +291,23 @@ insert into nullseg_many values (:'start_time', 1, NULL, NULL);
SELECT compress_chunk(:'chunk_to_compress');
select * from :compressed_chunk_name;

-- Test behaviour when no segmentby columns are present
SET timescaledb.debug_compression_path_info TO ON;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets enable this GUC for the complete test so we can verify that the correct index is being used for each recompression.

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.

2 participants