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

Open
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.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.34%. Comparing base (59f50f2) to head (26e2e0b).
Report is 734 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7632      +/-   ##
==========================================
+ Coverage   80.06%   81.34%   +1.27%     
==========================================
  Files         190      242      +52     
  Lines       37181    44821    +7640     
  Branches     9450    11178    +1728     
==========================================
+ Hits        29770    36459    +6689     
- Misses       2997     3976     +979     
+ Partials     4414     4386      -28     

☔ 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.

@kpan2034 kpan2034 force-pushed the optimize-non-segmentby branch from 5ab9b12 to 151bbf9 Compare February 5, 2025 00:05
@kpan2034 kpan2034 requested a review from antekresic February 5, 2025 00:05
Enables the segmentwise recompression flow to be used for chunks without
segmentby columns.

This should be more performant than doing a full recompression.
@kpan2034 kpan2034 force-pushed the optimize-non-segmentby branch from 151bbf9 to 26e2e0b Compare February 6, 2025 23:12
@kpan2034 kpan2034 marked this pull request as ready for review February 6, 2025 23:12
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