[Improve](row store) add more profile info in log for point query and make row column page size more configurable (#18181)
save about 20% FE cpu cost for point query with prepared statement which table contains 100 columns
This commit is contained in:
@ -937,6 +937,9 @@ CONF_Int32(max_depth_of_expr_tree, "600");
|
||||
// Report a tablet as bad when io errors occurs more than this value.
|
||||
CONF_mInt64(max_tablet_io_errors, "-1");
|
||||
|
||||
// Page size of row column, default 4KB
|
||||
CONF_mInt64(row_column_page_size, "4096");
|
||||
|
||||
#ifdef BE_TEST
|
||||
// test s3
|
||||
CONF_String(test_s3_resource, "resource");
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#include "olap/rowset/segment_v2/segment_writer.h"
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/consts.h"
|
||||
#include "common/logging.h" // LOG
|
||||
#include "io/fs/file_writer.h"
|
||||
@ -189,7 +190,7 @@ Status SegmentWriter::init(const std::vector<uint32_t>& col_ids, bool has_key,
|
||||
|
||||
if (column.is_row_store_column()) {
|
||||
// smaller page size for row store column
|
||||
opts.data_page_size = 16 * 1024;
|
||||
opts.data_page_size = config::row_column_page_size;
|
||||
}
|
||||
|
||||
std::unique_ptr<ColumnWriter> writer;
|
||||
|
||||
@ -2329,7 +2329,8 @@ TabletSchemaSPtr Tablet::get_max_version_schema(std::lock_guard<std::shared_mute
|
||||
|
||||
Status Tablet::lookup_row_data(const Slice& encoded_key, const RowLocation& row_location,
|
||||
RowsetSharedPtr input_rowset, const TupleDescriptor* desc,
|
||||
vectorized::Block* block, bool write_to_cache) {
|
||||
OlapReaderStatistics& stats, vectorized::Block* block,
|
||||
bool write_to_cache) {
|
||||
// read row data
|
||||
BetaRowsetSharedPtr rowset = std::static_pointer_cast<BetaRowset>(input_rowset);
|
||||
if (!rowset) {
|
||||
@ -2366,7 +2367,6 @@ Status Tablet::lookup_row_data(const Slice& encoded_key, const RowLocation& row_
|
||||
&column_iterator));
|
||||
std::unique_ptr<segment_v2::ColumnIterator> ptr_guard(column_iterator);
|
||||
segment_v2::ColumnIteratorOptions opt;
|
||||
OlapReaderStatistics stats;
|
||||
opt.file_reader = segment->file_reader().get();
|
||||
opt.stats = &stats;
|
||||
opt.use_page_cache = !config::disable_storage_page_cache;
|
||||
|
||||
@ -382,7 +382,8 @@ public:
|
||||
// Lookup a row with TupleDescriptor and fill Block
|
||||
Status lookup_row_data(const Slice& encoded_key, const RowLocation& row_location,
|
||||
RowsetSharedPtr rowset, const TupleDescriptor* desc,
|
||||
vectorized::Block* block, bool write_to_cache = false);
|
||||
OlapReaderStatistics& stats, vectorized::Block* block,
|
||||
bool write_to_cache = false);
|
||||
|
||||
// calc delete bitmap when flush memtable, use a fake version to calc
|
||||
// For example, cur max version is 5, and we use version 6 to calc but
|
||||
|
||||
@ -183,6 +183,7 @@ std::string PointQueryExecutor::print_profile() {
|
||||
auto lookup_data_us = _profile_metrics.lookup_data_ns.value() / 1000;
|
||||
auto output_data_us = _profile_metrics.output_data_ns.value() / 1000;
|
||||
auto total_us = init_us + lookup_key_us + lookup_data_us + output_data_us;
|
||||
auto read_stats = _profile_metrics.read_stats;
|
||||
return fmt::format(
|
||||
""
|
||||
"[lookup profile:{}us] init:{}us, init_key:{}us,"
|
||||
@ -192,10 +193,15 @@ std::string PointQueryExecutor::print_profile() {
|
||||
""
|
||||
""
|
||||
", is_binary_row:{}, output_columns:{}, total_keys:{}, row_cache_hits:{}"
|
||||
", hit_cached_pages:{}, total_pages_read:{}, compressed_bytes_read:{}, "
|
||||
"io_latency:{}ns, "
|
||||
"uncompressed_bytes_read:{}"
|
||||
"",
|
||||
total_us, init_us, init_key_us, lookup_key_us, lookup_data_us, output_data_us,
|
||||
_hit_lookup_cache, _binary_row_format, _reusable->output_exprs().size(),
|
||||
_row_read_ctxs.size(), _row_cache_hits);
|
||||
_row_read_ctxs.size(), _row_cache_hits, read_stats.cached_pages_num,
|
||||
read_stats.total_pages_num, read_stats.compressed_bytes_read, read_stats.io_ns,
|
||||
read_stats.uncompressed_bytes_read);
|
||||
}
|
||||
|
||||
Status PointQueryExecutor::_init_keys(const PTabletKeyLookupRequest* request) {
|
||||
@ -271,7 +277,8 @@ Status PointQueryExecutor::_lookup_row_data() {
|
||||
}
|
||||
RETURN_IF_ERROR(_tablet->lookup_row_data(
|
||||
_row_read_ctxs[i]._primary_key, _row_read_ctxs[i]._row_location.value(),
|
||||
*(_row_read_ctxs[i]._rowset_ptr), _reusable->tuple_desc(), _result_block.get(),
|
||||
*(_row_read_ctxs[i]._rowset_ptr), _reusable->tuple_desc(),
|
||||
_profile_metrics.read_stats, _result_block.get(),
|
||||
!config::disable_storage_row_cache /*whether write row cache*/));
|
||||
}
|
||||
return Status::OK();
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "common/status.h"
|
||||
#include "gen_cpp/internal_service.pb.h"
|
||||
#include "gutil/int128.h"
|
||||
#include "olap/olap_common.h"
|
||||
#include "olap/rowset/rowset.h"
|
||||
#include "olap/tablet.h"
|
||||
#include "util/runtime_profile.h"
|
||||
@ -234,6 +235,7 @@ struct Metrics {
|
||||
RuntimeProfile::Counter lookup_key_ns;
|
||||
RuntimeProfile::Counter lookup_data_ns;
|
||||
RuntimeProfile::Counter output_data_ns;
|
||||
OlapReaderStatistics read_stats;
|
||||
};
|
||||
|
||||
// An util to do tablet lookup
|
||||
|
||||
Reference in New Issue
Block a user