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

Cache pages for each column on demand #2805

Open
evenyag opened this issue Nov 23, 2023 · 0 comments
Open

Cache pages for each column on demand #2805

evenyag opened this issue Nov 23, 2023 · 0 comments
Assignees
Labels
C-enhancement Category Enhancements C-performance Category Performance

Comments

@evenyag
Copy link
Contributor

evenyag commented Nov 23, 2023

What type of enhancement is this?

Performance

What does the enhancement do?

Now we cache pages for the whole row group if there is a cache miss.

// We collect all pages and put them into the cache.
let pages = page_reader.collect::<Result<Vec<_>>>()?;
let page_value = Arc::new(PageValue::new(pages));
let page_key = PageKey {
region_id: self.region_id,
file_id: self.file_id,
row_group_idx: self.row_group_idx,
column_idx: i,
};
cache.put_pages(page_key, page_value.clone());

This might impact performance if we choose a larger row group size or if the row group contains multiple pages. We might cache individual keys for each column in a row group.

Implementation challenges

The reader has to load a compressed page into memory before decompressing it into pages

#[derive(Clone)]
enum ColumnChunkData {
/// Column chunk data representing only a subset of data pages
Sparse {
/// Length of the full column chunk
length: usize,
/// Set of data pages included in this sparse chunk. Each element is a tuple
/// of (page offset, page data)
data: Vec<(usize, Bytes)>,
},
/// Full column chunk and its offset
Dense { offset: usize, data: Bytes },

We might need to maintain two kinds of keys in the page cache

  • one for dense page of the column chunk
  • one for decompressed pages inside a column chunk
@evenyag evenyag added C-enhancement Category Enhancements C-performance Category Performance labels Nov 23, 2023
@evenyag evenyag self-assigned this Nov 23, 2023
@evenyag evenyag added this to mito2 Nov 27, 2023
@evenyag evenyag moved this to Todo in mito2 Nov 27, 2023
@evenyag evenyag self-assigned this Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements C-performance Category Performance
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants