85 std::vector<ColumnInfo> columns;
86 std::vector<ClusterInfo> clusters;
87 std::unordered_map<DescriptorId_t, unsigned int> cluster2Idx;
90 info.fFirstEntry = cluster.second.GetFirstEntryIndex();
91 info.fNEntries = cluster.second.GetNEntries();
92 cluster2Idx[cluster.first] = clusters.size();
93 clusters.emplace_back(info);
96 std::uint64_t bytesOnStorage = 0;
97 std::uint64_t bytesInMemory = 0;
98 std::uint64_t nPages = 0;
103 if (column.second.IsAliasColumn())
111 info.fPhysicalColumnId = column.second.GetPhysicalId();
112 info.fLogicalColumnId = column.second.GetLogicalId();
113 info.fFieldId = column.second.GetFieldId();
114 info.fLocalOrder = column.second.GetIndex();
115 info.fElementSize = elementSize;
116 info.fType = column.second.GetModel().GetType();
119 auto columnRange = cluster.second.GetColumnRange(column.second.GetPhysicalId());
120 info.fNElements += columnRange.fNElements;
121 if (compression == -1) {
122 compression = columnRange.fCompressionSettings;
124 const auto &pageRange = cluster.second.GetPageRange(column.second.GetPhysicalId());
125 auto idx = cluster2Idx[cluster.first];
126 for (
const auto &page : pageRange.fPageInfos) {
127 bytesOnStorage += page.fLocator.fBytesOnStorage;
128 bytesInMemory += page.fNElements * elementSize;
129 clusters[idx].fBytesOnStorage += page.fLocator.fBytesOnStorage;
130 clusters[idx].fBytesInMemory += page.fNElements * elementSize;
131 ++clusters[idx].fNPages;
132 info.fBytesOnStorage += page.fLocator.fBytesOnStorage;
137 columns.emplace_back(info);
141 output <<
"============================================================" << std::endl;
143 output <<
"Compression: " << compression << std::endl;
144 output <<
"------------------------------------------------------------" << std::endl;
149 output <<
" # Pages: " << nPages << std::endl;
151 output <<
" Size on storage: " << bytesOnStorage <<
" B" << std::endl;
152 output <<
" Compression rate: " << std::fixed << std::setprecision(2)
153 << float(bytesInMemory) / float(bytesOnStorage) << std::endl;
154 output <<
" Header size: " << headerSize <<
" B" << std::endl;
155 output <<
" Footer size: " << footerSize <<
" B" << std::endl;
156 output <<
" Meta-data / data: " << std::fixed << std::setprecision(3)
157 << float(headerSize + footerSize) / float(bytesOnStorage) << std::endl;
158 output <<
"------------------------------------------------------------" << std::endl;
159 output <<
"CLUSTER DETAILS" << std::endl;
160 output <<
"------------------------------------------------------------" << std::endl;
162 std::sort(clusters.begin(), clusters.end());
163 for (
unsigned int i = 0;
i < clusters.size(); ++
i) {
164 output <<
" # " << std::setw(5) <<
i
165 <<
" Entry range: [" << clusters[
i].fFirstEntry <<
".."
166 << clusters[
i].fFirstEntry + clusters[
i].fNEntries - 1 <<
"] -- " << clusters[
i].fNEntries << std::endl;
168 <<
" # Pages: " << clusters[
i].fNPages << std::endl;
170 <<
" Size on storage: " << clusters[
i].fBytesOnStorage <<
" B" << std::endl;
172 <<
" Compression: " << std::fixed << std::setprecision(2)
173 << float(clusters[
i].fBytesInMemory) / float(
float(clusters[
i].fBytesOnStorage)) << std::endl;
176 output <<
"------------------------------------------------------------" << std::endl;
177 output <<
"COLUMN DETAILS" << std::endl;
178 output <<
"------------------------------------------------------------" << std::endl;
179 for (
auto &col : columns) {
180 col.fFieldName = GetFieldName(col.fFieldId, *
this).substr(1);
181 col.fFieldDescription = GetFieldDescription(col.fFieldId, *
this);
183 std::sort(columns.begin(), columns.end());
184 for (
const auto &col : columns) {
185 auto avgPageSize = (col.fNPages == 0) ? 0 : (col.fBytesOnStorage / col.fNPages);
186 auto avgElementsPerPage = (col.fNPages == 0) ? 0 : (col.fNElements / col.fNPages);
187 std::string nameAndType = std::string(
" ") + col.fFieldName +
" [#" + std::to_string(col.fLocalOrder) +
"]" +
189 std::string
id = std::string(
"{id:") + std::to_string(col.fLogicalColumnId) +
"}";
190 if (col.fLogicalColumnId != col.fPhysicalColumnId)
191 id +=
" --alias--> " + std::to_string(col.fPhysicalColumnId);
192 output << nameAndType << std::setw(60 - nameAndType.length()) <<
id << std::endl;
193 if (!col.fFieldDescription.empty())
194 output <<
" Description: " << col.fFieldDescription << std::endl;
195 output <<
" # Elements: " << col.fNElements << std::endl;
196 output <<
" # Pages: " << col.fNPages << std::endl;
197 output <<
" Avg elements / page: " << avgElementsPerPage << std::endl;
198 output <<
" Avg page size: " << avgPageSize <<
" B" << std::endl;
199 output <<
" Size on storage: " << col.fBytesOnStorage <<
" B" << std::endl;
200 output <<
" Compression: " << std::fixed << std::setprecision(2)
201 << float(col.fElementSize * col.fNElements) / float(col.fBytesOnStorage) << std::endl;
202 output <<
"............................................................" << std::endl;