diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp index 6ce2108dbc42b1..63b5913690f014 100644 --- a/be/src/exec/tablet_sink.cpp +++ b/be/src/exec/tablet_sink.cpp @@ -1096,6 +1096,11 @@ void OlapTableSink::_prepare_profile(RuntimeState* state) { _client_rpc_timer = ADD_TIMER(_profile, "RpcClientSideTime"); _server_rpc_timer = ADD_TIMER(_profile, "RpcServerSideTime"); _server_wait_flush_timer = ADD_TIMER(_profile, "RpcServerWaitFlushTime"); + _profile->add_info_string("TxnID", fmt::format("{}", _txn_id)); + _profile->add_info_string("IndexNum", fmt::format("{}", _schema->indexes().size())); + _profile->add_info_string("ReplicatedStorage", fmt::format("{}", _enable_replicated_storage)); + _alloc_auto_increment_timer = ADD_TIMER(_profile, "AllocAutoIncrementTime"); + _profile->add_info_string("AutomaticPartition", fmt::format("{}", _enable_automatic_partition)); } void OlapTableSink::set_profile(RuntimeProfile* profile) { diff --git a/test/sql/test_profile/R/test_load_profile b/test/sql/test_profile/R/test_load_profile new file mode 100644 index 00000000000000..1fb9d0dd4b2e70 --- /dev/null +++ b/test/sql/test_profile/R/test_load_profile @@ -0,0 +1,46 @@ +-- name: test_load_profile +CREATE TABLE `t0` ( + `v1` int(11) NOT NULL, + `v2` int(11) NOT NULL, + `v3` int(11) NOT NULL +) ENGINE=OLAP +DUPLICATE KEY(`v1`) +DISTRIBUTED BY HASH(`v1`) BUCKETS 10 +PROPERTIES ( + "replication_num" = "1" +); +-- result: +-- !result +SET enable_profile="true"; +-- result: +-- !result +INSERT INTO `t0` (v1, v2, v3) values + (1, 1, 1), + (1, 1, 2), + (1, 1, 3), + (1, 2, 4), + (1, 2, 5), + (1, 2, 6), + (2, 3, 7), + (2, 3, 8), + (2, 3, 9), + (2, 4, 10), + (2, 4, 11), + (2, 4, 12); +-- result: +-- !result +with + profile as ( + select unnest as line from (values(1))t(v) join unnest(split(get_query_profile(last_query_id()), "\n") ) + ), result as ( + select * from profile + where REGEXP(line, "- (RowsRead|RowsReturned|RowsFiltered|OpenTime|CloseWaitTime|PrepareDataTime)") + OR REGEXP(line, "- (ConvertChunkTime|ValidateDataTime|SendDataTime|PackChunkTime|SendRpcTime)") + OR REGEXP(line, "- (WaitResponseTime|SerializeChunkTime|CompressTime|RpcClientSideTime|RpcServerSideTime)") + OR REGEXP(line, "- (RpcServerWaitFlushTime|TxnID|IndexNum|ReplicatedStorage|AllocAutoIncrementTime)") + OR REGEXP(line, "- (AutomaticPartition)") + ) +select count(*) from result; +-- result: +22 +-- !result \ No newline at end of file diff --git a/test/sql/test_profile/T/test_load_profile b/test/sql/test_profile/T/test_load_profile new file mode 100644 index 00000000000000..2b082c6993bd9c --- /dev/null +++ b/test/sql/test_profile/T/test_load_profile @@ -0,0 +1,40 @@ +-- name: test_load_profile +CREATE TABLE `t0` ( + `v1` int(11) NOT NULL, + `v2` int(11) NOT NULL, + `v3` int(11) NOT NULL +) ENGINE=OLAP +DUPLICATE KEY(`v1`) +DISTRIBUTED BY HASH(`v1`) BUCKETS 10 +PROPERTIES ( + "replication_num" = "1" +); + +SET enable_profile="true"; + +INSERT INTO `t0` (v1, v2, v3) values + (1, 1, 1), + (1, 1, 2), + (1, 1, 3), + (1, 2, 4), + (1, 2, 5), + (1, 2, 6), + (2, 3, 7), + (2, 3, 8), + (2, 3, 9), + (2, 4, 10), + (2, 4, 11), + (2, 4, 12); + +with + profile as ( + select unnest as line from (values(1))t(v) join unnest(split(get_query_profile(last_query_id()), "\n") ) + ), result as ( + select * from profile + where REGEXP(line, "- (RowsRead|RowsReturned|RowsFiltered|OpenTime|CloseWaitTime|PrepareDataTime)") + OR REGEXP(line, "- (ConvertChunkTime|ValidateDataTime|SendDataTime|PackChunkTime|SendRpcTime)") + OR REGEXP(line, "- (WaitResponseTime|SerializeChunkTime|CompressTime|RpcClientSideTime|RpcServerSideTime)") + OR REGEXP(line, "- (RpcServerWaitFlushTime|TxnID|IndexNum|ReplicatedStorage|AllocAutoIncrementTime)") + OR REGEXP(line, "- (AutomaticPartition)") + ) +select count(*) from result; \ No newline at end of file