diff --git a/src/Common/ProfileEvents.cpp b/src/Common/ProfileEvents.cpp index 4d1a30d7676..d831402fd37 100644 --- a/src/Common/ProfileEvents.cpp +++ b/src/Common/ProfileEvents.cpp @@ -199,11 +199,11 @@ \ M(MergeTreeDataWriterSkipIndicesCalculationMicroseconds, "Time spent calculating skip indices") \ M(MergeTreeDataWriterStatisticsCalculationMicroseconds, "Time spent calculating statistics") \ - M(MergeTreeDataWriterPrimaryKeyCalculationMicroseconds, "Time spent calculating primary key") \ + M(MergeTreeDataWriterSortingBlocksMicroseconds, "Time spent sorting blocks") \ M(MergeTreeDataWriterMergingBlocksMicroseconds, "Time spent merging input blocks (for special MergeTree engines)") \ M(MergeTreeDataWriterProjectionsCalculationMicroseconds, "Time spent calculating projections") \ - M(MergeTreeDataProjectionWriterPrimaryKeyCalculationMicroseconds, "Time spent calculating primary key") \ - M(MergeTreeDataProjectionWriterMergingBlocksMicroseconds, "Time spent merging input blocks") \ + M(MergeTreeDataProjectionWriterSortingBlocksMicroseconds, "Time spent sorting blocks (for projection it might be a key different from table's sorting key)") \ + M(MergeTreeDataProjectionWriterMergingBlocksMicroseconds, "Time spent merging blocks") \ M(MutateTaskProjectionsCalculationMicroseconds, "Time spent calculating projections") \ \ M(InsertedWideParts, "Number of parts inserted in Wide format.") \ diff --git a/src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp b/src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp index b8cfdf19f54..fd83d2ebfe9 100644 --- a/src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp +++ b/src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp @@ -500,7 +500,7 @@ void MergeTreeDataPartWriterOnDisk::finishStatisticsSerialization(bool sync) } for (size_t i = 0; i < stats.size(); ++i) - LOG_DEBUG(log, "Spent {} ms calculating statistics {}", execution_stats.statistics_build_us[i] / 1000, stats[i]->columnName()); + LOG_DEBUG(log, "Spent {} ms calculating statistics {} for the part {}", execution_stats.statistics_build_us[i] / 1000, stats[i]->columnName(), data_part->name); } void MergeTreeDataPartWriterOnDisk::fillStatisticsChecksums(MergeTreeData::DataPart::Checksums & checksums) @@ -526,7 +526,7 @@ void MergeTreeDataPartWriterOnDisk::finishSkipIndicesSerialization(bool sync) store.second->finalize(); for (size_t i = 0; i < skip_indices.size(); ++i) - LOG_DEBUG(log, "Spent {} ms calculating index {}", execution_stats.skip_indices_build_us[i] / 1000, skip_indices[i]->index.name); + LOG_DEBUG(log, "Spent {} ms calculating index {} for the part {}", execution_stats.skip_indices_build_us[i] / 1000, skip_indices[i]->index.name, data_part->name); gin_index_stores.clear(); skip_indices_streams.clear(); diff --git a/src/Storages/MergeTree/MergeTreeDataWriter.cpp b/src/Storages/MergeTree/MergeTreeDataWriter.cpp index 8f522832bce..0418bf6fc7d 100644 --- a/src/Storages/MergeTree/MergeTreeDataWriter.cpp +++ b/src/Storages/MergeTree/MergeTreeDataWriter.cpp @@ -36,7 +36,7 @@ namespace ProfileEvents extern const Event MergeTreeDataWriterRows; extern const Event MergeTreeDataWriterUncompressedBytes; extern const Event MergeTreeDataWriterCompressedBytes; - extern const Event MergeTreeDataWriterPrimaryKeyCalculationMicroseconds; + extern const Event MergeTreeDataWriterSortingBlocksMicroseconds; extern const Event MergeTreeDataWriterMergingBlocksMicroseconds; extern const Event MergeTreeDataWriterProjectionsCalculationMicroseconds; extern const Event MergeTreeDataProjectionWriterBlocks; @@ -44,7 +44,7 @@ namespace ProfileEvents extern const Event MergeTreeDataProjectionWriterRows; extern const Event MergeTreeDataProjectionWriterUncompressedBytes; extern const Event MergeTreeDataProjectionWriterCompressedBytes; - extern const Event MergeTreeDataProjectionWriterPrimaryKeyCalculationMicroseconds; + extern const Event MergeTreeDataProjectionWriterSortingBlocksMicroseconds; extern const Event MergeTreeDataProjectionWriterMergingBlocksMicroseconds; extern const Event RejectedInserts; } @@ -478,7 +478,7 @@ MergeTreeDataWriter::TemporaryPart MergeTreeDataWriter::writeTempPartImpl( IColumn::Permutation perm; if (!sort_description.empty()) { - ProfileEventTimeIncrement watch(ProfileEvents::MergeTreeDataWriterPrimaryKeyCalculationMicroseconds); + ProfileEventTimeIncrement watch(ProfileEvents::MergeTreeDataWriterSortingBlocksMicroseconds); if (!isAlreadySorted(block, sort_description)) { @@ -702,7 +702,7 @@ MergeTreeDataWriter::TemporaryPart MergeTreeDataWriter::writeProjectionPartImpl( IColumn::Permutation perm; if (!sort_description.empty()) { - ProfileEventTimeIncrement watch(ProfileEvents::MergeTreeDataProjectionWriterPrimaryKeyCalculationMicroseconds); + ProfileEventTimeIncrement watch(ProfileEvents::MergeTreeDataProjectionWriterSortingBlocksMicroseconds); if (!isAlreadySorted(block, sort_description)) { diff --git a/tests/queries/0_stateless/02982_perf_introspection_for_inserts.sh b/tests/queries/0_stateless/02982_perf_introspection_for_inserts.sh index a249cbef6a2..f5fb54b54d3 100755 --- a/tests/queries/0_stateless/02982_perf_introspection_for_inserts.sh +++ b/tests/queries/0_stateless/02982_perf_introspection_for_inserts.sh @@ -37,8 +37,8 @@ $CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS" $CLICKHOUSE_CLIENT -q """ SELECT ProfileEvents['MergeTreeDataProjectionWriterMergingBlocksMicroseconds'] > 0, - ProfileEvents['MergeTreeDataProjectionWriterPrimaryKeyCalculationMicroseconds'] > 0, - ProfileEvents['MergeTreeDataWriterPrimaryKeyCalculationMicroseconds'] > 0, + ProfileEvents['MergeTreeDataProjectionWriterSortingBlocksMicroseconds'] > 0, + ProfileEvents['MergeTreeDataWriterSortingBlocksMicroseconds'] > 0, ProfileEvents['MergeTreeDataWriterProjectionsCalculationMicroseconds'] > 0, ProfileEvents['MergeTreeDataWriterSkipIndicesCalculationMicroseconds'] > 0 FROM system.query_log