Skip to content

Commit

Permalink
Merge pull request ClickHouse#60049 from ClickHouse/less-memory-usage…
Browse files Browse the repository at this point in the history
…-primary-key

Maybe less memory usage for primary keys in memory
  • Loading branch information
alexey-milovidov committed Feb 17, 2024
2 parents 6b32622 + 20b9e51 commit 6cae757
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Storages/MergeTree/IMergeTreeDataPart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ void IMergeTreeDataPart::loadIndex()

for (size_t i = 0; i < key_size; ++i)
{
loaded_index[i]->shrinkToFit();
loaded_index[i]->protect();
if (loaded_index[i]->size() != marks_count)
throw Exception(ErrorCodes::CANNOT_READ_ALL_DATA, "Cannot read all data from index file {}(expected size: "
Expand Down
2 changes: 1 addition & 1 deletion src/Storages/MergeTree/IMergeTreeDataPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ class IMergeTreeDataPart : public std::enable_shared_from_this<IMergeTreeDataPar

virtual void appendFilesOfIndexGranularity(Strings & files) const;

/// Loads index file.
/// Loads the index file.
void loadIndex();

void appendFilesOfIndex(Strings & files) const;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT primary_key_bytes_in_memory < 16000, primary_key_bytes_in_memory_allocated < 16000, primary_key_bytes_in_memory_allocated / primary_key_bytes_in_memory < 1.1 FROM system.parts WHERE database = 'test' AND table = 'hits';

0 comments on commit 6cae757

Please sign in to comment.