From ce5e4c19d11193a5f2004e705ae9e3980a0524fe Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Fri, 24 Jun 2022 17:48:44 -0700 Subject: [PATCH] sql: expose the number of BatchRequests issued by the fetchers This commit teaches `row.KVFetcher` to track the number of BatchRequests issued to perform the reads and then exposes this information along side other execution statistics like the number of bytes read. I imagine that this can be handy in some cases, but even more so with the increased usage of the streamer. Release note (sql change): A new execution statistic that tracks the number of gRPC calls issued to perform the read operations has been added to EXPLAIN ANALYZE output. It exposes low-level details that might aid with debugging the performance of queries for power users. --- pkg/kv/kvclient/kvstreamer/streamer.go | 14 +++++ pkg/kv/kvclient/kvstreamer/streamer_test.go | 2 + pkg/sql/colexecop/operator.go | 3 + pkg/sql/colfetcher/cfetcher.go | 24 ++++++-- pkg/sql/colfetcher/colbatch_scan.go | 7 +++ pkg/sql/colfetcher/index_join.go | 12 ++-- pkg/sql/colflow/stats.go | 1 + pkg/sql/execinfrapb/component_stats.go | 10 ++++ pkg/sql/execinfrapb/component_stats.proto | 1 + pkg/sql/execstats/traceanalyzer.go | 59 +++++++++++-------- pkg/sql/execstats/traceanalyzer_test.go | 57 +++++++++--------- pkg/sql/instrumentation.go | 3 +- .../exec/execbuilder/testdata/dist_vectorize | 11 ++-- .../exec/execbuilder/testdata/distsql_misc | 4 +- .../exec/execbuilder/testdata/explain_analyze | 8 ++- .../testdata/explain_analyze_plans | 34 +++++++---- .../testdata/inverted_index_geospatial | 18 ++++-- .../execbuilder/testdata/lookup_join_limit | 17 +++++- pkg/sql/opt/exec/execbuilder/testdata/prepare | 4 +- .../exec/execbuilder/testdata/vectorize_local | 17 ++++-- pkg/sql/opt/exec/explain/emit.go | 3 + pkg/sql/opt/exec/explain/output.go | 8 ++- pkg/sql/opt/exec/factory.go | 9 +-- pkg/sql/row/fetcher.go | 21 +++++-- pkg/sql/row/kv_batch_fetcher.go | 3 +- pkg/sql/row/kv_fetcher.go | 29 +++++++-- pkg/sql/rowexec/inverted_joiner.go | 9 +-- pkg/sql/rowexec/joinreader.go | 9 +-- pkg/sql/rowexec/rowfetcher.go | 1 + pkg/sql/rowexec/stats.go | 5 ++ pkg/sql/rowexec/tablereader.go | 9 +-- pkg/sql/rowexec/zigzagjoiner.go | 13 +++- 32 files changed, 294 insertions(+), 131 deletions(-) diff --git a/pkg/kv/kvclient/kvstreamer/streamer.go b/pkg/kv/kvclient/kvstreamer/streamer.go index 3a7dd8ddb366..64d528a877ab 100644 --- a/pkg/kv/kvclient/kvstreamer/streamer.go +++ b/pkg/kv/kvclient/kvstreamer/streamer.go @@ -17,6 +17,7 @@ import ( "runtime" "sort" "sync" + "sync/atomic" "unsafe" "github.com/cockroachdb/cockroach/pkg/keys" @@ -225,6 +226,10 @@ type Streamer struct { maxKeysPerRow int32 budget *budget + atomics struct { + batchRequestsIssued *int64 + } + coordinator workerCoordinator coordinatorStarted bool coordinatorCtxCancel context.CancelFunc @@ -304,6 +309,9 @@ func max(a, b int64) int64 { // The Streamer takes ownership of the memory account, and the caller is allowed // to interact with the account only after canceling the Streamer (because // memory accounts are not thread-safe). +// +// batchRequestsIssued should be incremented every time a new BatchRequest is +// sent. func NewStreamer( distSender *kvcoord.DistSender, stopper *stop.Stopper, @@ -312,6 +320,7 @@ func NewStreamer( lockWaitPolicy lock.WaitPolicy, limitBytes int64, acc *mon.BoundAccount, + batchRequestsIssued *int64, ) *Streamer { if txn.Type() != kv.LeafTxn { panic(errors.AssertionFailedf("RootTxn is given to the Streamer")) @@ -321,6 +330,10 @@ func NewStreamer( stopper: stopper, budget: newBudget(acc, limitBytes), } + if batchRequestsIssued == nil { + batchRequestsIssued = new(int64) + } + s.atomics.batchRequestsIssued = batchRequestsIssued s.coordinator = workerCoordinator{ s: s, txn: txn, @@ -1078,6 +1091,7 @@ func (w *workerCoordinator) performRequestAsync( w.s.results.setError(err.GoError()) return } + atomic.AddInt64(w.s.atomics.batchRequestsIssued, 1) // First, we have to reconcile the memory budget. We do it // separately from processing the results because we want to know diff --git a/pkg/kv/kvclient/kvstreamer/streamer_test.go b/pkg/kv/kvclient/kvstreamer/streamer_test.go index df2939656cc4..2a003fc51793 100644 --- a/pkg/kv/kvclient/kvstreamer/streamer_test.go +++ b/pkg/kv/kvclient/kvstreamer/streamer_test.go @@ -46,6 +46,7 @@ func getStreamer( lock.WaitPolicy(0), limitBytes, acc, + nil, /* batchRequestsIssued */ ) } @@ -96,6 +97,7 @@ func TestStreamerLimitations(t *testing.T) { lock.WaitPolicy(0), math.MaxInt64, /* limitBytes */ nil, /* acc */ + nil, /* batchRequestsIssued */ ) }) }) diff --git a/pkg/sql/colexecop/operator.go b/pkg/sql/colexecop/operator.go index e9d26d7571a2..416d99c87f17 100644 --- a/pkg/sql/colexecop/operator.go +++ b/pkg/sql/colexecop/operator.go @@ -70,6 +70,9 @@ type KVReader interface { // GetRowsRead returns the number of rows read from KV by this operator. // It must be safe for concurrent use. GetRowsRead() int64 + // GetBatchRequestsIssued returns the number of BatchRequests issued to KV + // by this operator. It must be safe for concurrent use. + GetBatchRequestsIssued() int64 // GetCumulativeContentionTime returns the amount of time KV reads spent // contending. It must be safe for concurrent use. GetCumulativeContentionTime() time.Duration diff --git a/pkg/sql/colfetcher/cfetcher.go b/pkg/sql/colfetcher/cfetcher.go index 49faf4d99b67..27b544a0d78c 100644 --- a/pkg/sql/colfetcher/cfetcher.go +++ b/pkg/sql/colfetcher/cfetcher.go @@ -214,13 +214,15 @@ type cFetcher struct { // fetcher is the underlying fetcher that provides KVs. fetcher *row.KVFetcher - // bytesRead stores the total number of bytes read by this cFetcher - // throughout its lifetime in case when the underlying row.KVFetcher has - // already been closed and nil-ed out. + // bytesRead and batchRequestsIssued store the total number of bytes read + // and of BatchRequests issued, respectively, by this cFetcher throughout + // its lifetime in case when the underlying row.KVFetcher has already been + // closed and nil-ed out. // - // The field should not be accessed directly by the users of the cFetcher - - // getBytesRead() should be used instead. - bytesRead int64 + // The fields should not be accessed directly by the users of the cFetcher - + // getBytesRead() and getBatchRequestsIssued() should be used instead. + bytesRead int64 + batchRequestsIssued int64 // machine contains fields that get updated during the run of the fetcher. machine struct { @@ -1292,6 +1294,15 @@ func (cf *cFetcher) getBytesRead() int64 { return cf.bytesRead } +// getBatchRequestsIssued returns the number of BatchRequests issued by the +// cFetcher throughout its lifetime so far. +func (cf *cFetcher) getBatchRequestsIssued() int64 { + if cf.fetcher != nil { + return cf.fetcher.GetBatchRequestsIssued() + } + return cf.batchRequestsIssued +} + var cFetcherPool = sync.Pool{ New: func() interface{} { return &cFetcher{} @@ -1315,6 +1326,7 @@ func (cf *cFetcher) Release() { func (cf *cFetcher) Close(ctx context.Context) { if cf != nil && cf.fetcher != nil { cf.bytesRead = cf.fetcher.GetBytesRead() + cf.batchRequestsIssued = cf.fetcher.GetBatchRequestsIssued() cf.fetcher.Close(ctx) cf.fetcher = nil } diff --git a/pkg/sql/colfetcher/colbatch_scan.go b/pkg/sql/colfetcher/colbatch_scan.go index bd8d122f639f..1d950357b64b 100644 --- a/pkg/sql/colfetcher/colbatch_scan.go +++ b/pkg/sql/colfetcher/colbatch_scan.go @@ -157,6 +157,13 @@ func (s *ColBatchScan) GetRowsRead() int64 { return s.mu.rowsRead } +// GetBatchRequestsIssued is part of the colexecop.KVReader interface. +func (s *ColBatchScan) GetBatchRequestsIssued() int64 { + s.mu.Lock() + defer s.mu.Unlock() + return s.cf.getBatchRequestsIssued() +} + // GetCumulativeContentionTime is part of the colexecop.KVReader interface. func (s *ColBatchScan) GetCumulativeContentionTime() time.Duration { return execstats.GetCumulativeContentionTime(s.Ctx, nil /* recording */) diff --git a/pkg/sql/colfetcher/index_join.go b/pkg/sql/colfetcher/index_join.go index 22c9c2426ab2..057cbfd346c5 100644 --- a/pkg/sql/colfetcher/index_join.go +++ b/pkg/sql/colfetcher/index_join.go @@ -25,7 +25,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/colexecop" "github.com/cockroachdb/cockroach/pkg/sql/colmem" "github.com/cockroachdb/cockroach/pkg/sql/execinfra" - "github.com/cockroachdb/cockroach/pkg/sql/execinfra/execreleasable" "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroach/pkg/sql/execstats" "github.com/cockroachdb/cockroach/pkg/sql/memsize" @@ -126,9 +125,7 @@ type ColIndexJoin struct { usesStreamer bool } -var _ colexecop.KVReader = &ColIndexJoin{} -var _ execreleasable.Releasable = &ColIndexJoin{} -var _ colexecop.ClosableOperator = &ColIndexJoin{} +var _ ScanOperator = &ColIndexJoin{} // Init initializes a ColIndexJoin. func (s *ColIndexJoin) Init(ctx context.Context) { @@ -392,6 +389,13 @@ func (s *ColIndexJoin) GetRowsRead() int64 { return s.mu.rowsRead } +// GetBatchRequestsIssued is part of the colexecop.KVReader interface. +func (s *ColIndexJoin) GetBatchRequestsIssued() int64 { + s.mu.Lock() + defer s.mu.Unlock() + return s.cf.getBatchRequestsIssued() +} + // GetCumulativeContentionTime is part of the colexecop.KVReader interface. func (s *ColIndexJoin) GetCumulativeContentionTime() time.Duration { return execstats.GetCumulativeContentionTime(s.Ctx, nil /* recording */) diff --git a/pkg/sql/colflow/stats.go b/pkg/sql/colflow/stats.go index 289d3e1be7d1..600373fb9c53 100644 --- a/pkg/sql/colflow/stats.go +++ b/pkg/sql/colflow/stats.go @@ -223,6 +223,7 @@ func (vsc *vectorizedStatsCollectorImpl) GetStats() *execinfrapb.ComponentStats s.KV.KVTime.Set(time) s.KV.TuplesRead.Set(uint64(vsc.kvReader.GetRowsRead())) s.KV.BytesRead.Set(uint64(vsc.kvReader.GetBytesRead())) + s.KV.BatchRequestsIssued.Set(uint64(vsc.kvReader.GetBatchRequestsIssued())) s.KV.ContentionTime.Set(vsc.kvReader.GetCumulativeContentionTime()) scanStats := vsc.kvReader.GetScanStats() execstats.PopulateKVMVCCStats(&s.KV, &scanStats) diff --git a/pkg/sql/execinfrapb/component_stats.go b/pkg/sql/execinfrapb/component_stats.go index ecad65b04325..9277127f562b 100644 --- a/pkg/sql/execinfrapb/component_stats.go +++ b/pkg/sql/execinfrapb/component_stats.go @@ -151,6 +151,9 @@ func (s *ComponentStats) formatStats(fn func(suffix string, value interface{})) if s.KV.BytesRead.HasValue() { fn("KV bytes read", humanize.IBytes(s.KV.BytesRead.Value())) } + if s.KV.BatchRequestsIssued.HasValue() { + fn("KV gRPC calls", humanizeutil.Count(s.KV.BatchRequestsIssued.Value())) + } if s.KV.NumInterfaceSteps.HasValue() { fn("MVCC step count (ext/int)", fmt.Sprintf("%s/%s", @@ -249,6 +252,9 @@ func (s *ComponentStats) Union(other *ComponentStats) *ComponentStats { if !result.KV.BytesRead.HasValue() { result.KV.BytesRead = other.KV.BytesRead } + if !result.KV.BatchRequestsIssued.HasValue() { + result.KV.BatchRequestsIssued = other.KV.BatchRequestsIssued + } // Exec stats. if !result.Exec.ExecTime.HasValue() { @@ -340,6 +346,10 @@ func (s *ComponentStats) MakeDeterministic() { // BytesRead is overridden to a useful value for tests. s.KV.BytesRead.Set(8 * s.KV.TuplesRead.Value()) } + if s.KV.BatchRequestsIssued.HasValue() { + // BatchRequestsIssued is overridden to a useful value for tests. + s.KV.BatchRequestsIssued.Set(s.KV.TuplesRead.Value()) + } // Exec. timeVal(&s.Exec.ExecTime) diff --git a/pkg/sql/execinfrapb/component_stats.proto b/pkg/sql/execinfrapb/component_stats.proto index 5d01450cc058..014a183bb645 100644 --- a/pkg/sql/execinfrapb/component_stats.proto +++ b/pkg/sql/execinfrapb/component_stats.proto @@ -121,6 +121,7 @@ message NetworkTxStats { message KVStats { optional util.optional.Uint bytes_read = 1 [(gogoproto.nullable) = false]; optional util.optional.Uint tuples_read = 2 [(gogoproto.nullable) = false]; + optional util.optional.Uint batch_requests_issued = 9 [(gogoproto.nullable) = false]; // Cumulated time spent waiting for a KV request. This includes disk IO time // and potentially network time (if any of the keys are not local). diff --git a/pkg/sql/execstats/traceanalyzer.go b/pkg/sql/execstats/traceanalyzer.go index da2b96a7bb9b..f3aa593af932 100644 --- a/pkg/sql/execstats/traceanalyzer.go +++ b/pkg/sql/execstats/traceanalyzer.go @@ -99,29 +99,31 @@ func NewFlowsMetadata(flows map[base.SQLInstanceID]*execinfrapb.FlowSpec) *Flows // TODO(asubiotto): Flatten this struct, we're currently allocating a map per // stat. type NodeLevelStats struct { - NetworkBytesSentGroupedByNode map[base.SQLInstanceID]int64 - MaxMemoryUsageGroupedByNode map[base.SQLInstanceID]int64 - MaxDiskUsageGroupedByNode map[base.SQLInstanceID]int64 - KVBytesReadGroupedByNode map[base.SQLInstanceID]int64 - KVRowsReadGroupedByNode map[base.SQLInstanceID]int64 - KVTimeGroupedByNode map[base.SQLInstanceID]time.Duration - NetworkMessagesGroupedByNode map[base.SQLInstanceID]int64 - ContentionTimeGroupedByNode map[base.SQLInstanceID]time.Duration + NetworkBytesSentGroupedByNode map[base.SQLInstanceID]int64 + MaxMemoryUsageGroupedByNode map[base.SQLInstanceID]int64 + MaxDiskUsageGroupedByNode map[base.SQLInstanceID]int64 + KVBytesReadGroupedByNode map[base.SQLInstanceID]int64 + KVRowsReadGroupedByNode map[base.SQLInstanceID]int64 + KVBatchRequestsIssuedGroupedByNode map[base.SQLInstanceID]int64 + KVTimeGroupedByNode map[base.SQLInstanceID]time.Duration + NetworkMessagesGroupedByNode map[base.SQLInstanceID]int64 + ContentionTimeGroupedByNode map[base.SQLInstanceID]time.Duration } // QueryLevelStats returns all the query level stats that correspond to the // given traces and flow metadata. // NOTE: When adding fields to this struct, be sure to update Accumulate. type QueryLevelStats struct { - NetworkBytesSent int64 - MaxMemUsage int64 - MaxDiskUsage int64 - KVBytesRead int64 - KVRowsRead int64 - KVTime time.Duration - NetworkMessages int64 - ContentionTime time.Duration - Regions []string + NetworkBytesSent int64 + MaxMemUsage int64 + MaxDiskUsage int64 + KVBytesRead int64 + KVRowsRead int64 + KVBatchRequestsIssued int64 + KVTime time.Duration + NetworkMessages int64 + ContentionTime time.Duration + Regions []string } // Accumulate accumulates other's stats into the receiver. @@ -135,6 +137,7 @@ func (s *QueryLevelStats) Accumulate(other QueryLevelStats) { } s.KVBytesRead += other.KVBytesRead s.KVRowsRead += other.KVRowsRead + s.KVBatchRequestsIssued += other.KVBatchRequestsIssued s.KVTime += other.KVTime s.NetworkMessages += other.NetworkMessages s.ContentionTime += other.ContentionTime @@ -205,14 +208,15 @@ func (a *TraceAnalyzer) AddTrace(trace []tracingpb.RecordedSpan, makeDeterminist func (a *TraceAnalyzer) ProcessStats() error { // Process node level stats. a.nodeLevelStats = NodeLevelStats{ - NetworkBytesSentGroupedByNode: make(map[base.SQLInstanceID]int64), - MaxMemoryUsageGroupedByNode: make(map[base.SQLInstanceID]int64), - MaxDiskUsageGroupedByNode: make(map[base.SQLInstanceID]int64), - KVBytesReadGroupedByNode: make(map[base.SQLInstanceID]int64), - KVRowsReadGroupedByNode: make(map[base.SQLInstanceID]int64), - KVTimeGroupedByNode: make(map[base.SQLInstanceID]time.Duration), - NetworkMessagesGroupedByNode: make(map[base.SQLInstanceID]int64), - ContentionTimeGroupedByNode: make(map[base.SQLInstanceID]time.Duration), + NetworkBytesSentGroupedByNode: make(map[base.SQLInstanceID]int64), + MaxMemoryUsageGroupedByNode: make(map[base.SQLInstanceID]int64), + MaxDiskUsageGroupedByNode: make(map[base.SQLInstanceID]int64), + KVBytesReadGroupedByNode: make(map[base.SQLInstanceID]int64), + KVRowsReadGroupedByNode: make(map[base.SQLInstanceID]int64), + KVBatchRequestsIssuedGroupedByNode: make(map[base.SQLInstanceID]int64), + KVTimeGroupedByNode: make(map[base.SQLInstanceID]time.Duration), + NetworkMessagesGroupedByNode: make(map[base.SQLInstanceID]int64), + ContentionTimeGroupedByNode: make(map[base.SQLInstanceID]time.Duration), } var errs error @@ -224,6 +228,7 @@ func (a *TraceAnalyzer) ProcessStats() error { instanceID := stats.Component.SQLInstanceID a.nodeLevelStats.KVBytesReadGroupedByNode[instanceID] += int64(stats.KV.BytesRead.Value()) a.nodeLevelStats.KVRowsReadGroupedByNode[instanceID] += int64(stats.KV.TuplesRead.Value()) + a.nodeLevelStats.KVBatchRequestsIssuedGroupedByNode[instanceID] += int64(stats.KV.BatchRequestsIssued.Value()) a.nodeLevelStats.KVTimeGroupedByNode[instanceID] += stats.KV.KVTime.Value() a.nodeLevelStats.ContentionTimeGroupedByNode[instanceID] += stats.KV.ContentionTime.Value() } @@ -320,6 +325,10 @@ func (a *TraceAnalyzer) ProcessStats() error { a.queryLevelStats.KVRowsRead += kvRowsRead } + for _, kvBatchRequestsIssued := range a.nodeLevelStats.KVBatchRequestsIssuedGroupedByNode { + a.queryLevelStats.KVBatchRequestsIssued += kvBatchRequestsIssued + } + for _, kvTime := range a.nodeLevelStats.KVTimeGroupedByNode { a.queryLevelStats.KVTime += kvTime } diff --git a/pkg/sql/execstats/traceanalyzer_test.go b/pkg/sql/execstats/traceanalyzer_test.go index f666f4f879ab..7aeb41902e46 100644 --- a/pkg/sql/execstats/traceanalyzer_test.go +++ b/pkg/sql/execstats/traceanalyzer_test.go @@ -241,37 +241,40 @@ func TestTraceAnalyzerProcessStats(t *testing.T) { func TestQueryLevelStatsAccumulate(t *testing.T) { a := execstats.QueryLevelStats{ - NetworkBytesSent: 1, - MaxMemUsage: 2, - KVBytesRead: 3, - KVRowsRead: 4, - KVTime: 5 * time.Second, - NetworkMessages: 6, - ContentionTime: 7 * time.Second, - MaxDiskUsage: 8, - Regions: []string{"gcp-us-east1"}, + NetworkBytesSent: 1, + MaxMemUsage: 2, + KVBytesRead: 3, + KVRowsRead: 4, + KVBatchRequestsIssued: 4, + KVTime: 5 * time.Second, + NetworkMessages: 6, + ContentionTime: 7 * time.Second, + MaxDiskUsage: 8, + Regions: []string{"gcp-us-east1"}, } b := execstats.QueryLevelStats{ - NetworkBytesSent: 8, - MaxMemUsage: 9, - KVBytesRead: 10, - KVRowsRead: 11, - KVTime: 12 * time.Second, - NetworkMessages: 13, - ContentionTime: 14 * time.Second, - MaxDiskUsage: 15, - Regions: []string{"gcp-us-west1"}, + NetworkBytesSent: 8, + MaxMemUsage: 9, + KVBytesRead: 10, + KVRowsRead: 11, + KVBatchRequestsIssued: 11, + KVTime: 12 * time.Second, + NetworkMessages: 13, + ContentionTime: 14 * time.Second, + MaxDiskUsage: 15, + Regions: []string{"gcp-us-west1"}, } expected := execstats.QueryLevelStats{ - NetworkBytesSent: 9, - MaxMemUsage: 9, - KVBytesRead: 13, - KVRowsRead: 15, - KVTime: 17 * time.Second, - NetworkMessages: 19, - ContentionTime: 21 * time.Second, - MaxDiskUsage: 15, - Regions: []string{"gcp-us-east1", "gcp-us-west1"}, + NetworkBytesSent: 9, + MaxMemUsage: 9, + KVBytesRead: 13, + KVRowsRead: 15, + KVBatchRequestsIssued: 15, + KVTime: 17 * time.Second, + NetworkMessages: 19, + ContentionTime: 21 * time.Second, + MaxDiskUsage: 15, + Regions: []string{"gcp-us-east1", "gcp-us-west1"}, } aCopy := a diff --git a/pkg/sql/instrumentation.go b/pkg/sql/instrumentation.go index 3f1bb33915ae..4853b398d91a 100644 --- a/pkg/sql/instrumentation.go +++ b/pkg/sql/instrumentation.go @@ -469,7 +469,7 @@ func (ih *instrumentationHelper) emitExplainAnalyzePlanToOutputBuilder( ob.AddVectorized(ih.vectorized) if queryStats.KVRowsRead != 0 { - ob.AddKVReadStats(queryStats.KVRowsRead, queryStats.KVBytesRead) + ob.AddKVReadStats(queryStats.KVRowsRead, queryStats.KVBytesRead, queryStats.KVBatchRequestsIssued) } if queryStats.KVTime != 0 { ob.AddKVTime(queryStats.KVTime) @@ -606,6 +606,7 @@ func (m execNodeTraceMetadata) annotateExplain( nodeStats.KVContentionTime.MaybeAdd(stats.KV.ContentionTime) nodeStats.KVBytesRead.MaybeAdd(stats.KV.BytesRead) nodeStats.KVRowsRead.MaybeAdd(stats.KV.TuplesRead) + nodeStats.KVBatchRequestsIssued.MaybeAdd(stats.KV.BatchRequestsIssued) nodeStats.StepCount.MaybeAdd(stats.KV.NumInterfaceSteps) nodeStats.InternalStepCount.MaybeAdd(stats.KV.NumInternalSteps) nodeStats.SeekCount.MaybeAdd(stats.KV.NumInterfaceSeeks) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize index 1db6b6c7747f..2e39bd365f10 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize +++ b/pkg/sql/opt/exec/execbuilder/testdata/dist_vectorize @@ -55,7 +55,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 5 (40 B) +rows read from KV: 5 (40 B, 5 gRPC calls) maximum memory usage: network usage: regions: @@ -73,12 +73,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzslt9u2jwUwO-_p7DOFf1klL-01FfdUCdVW8sEtLuYUOUmRywisTPbobCKx9oL7MkmkmYjtA1B08QkeulzfOKTn3-2_AD6awwMhucfznsjEshMmNb_R-TdoH9JpjOgIGSIVzxBDewzOEDBBQoeUPCBQgfGFFIlA9RaqtWUh7zgIpwDsylEIs3MKjymEEiFwB7ARCZGYDDidzEOkIeoLBsohGh4FOfLTGdn09ltOsUFUOjJOEuEZkBhmHKhGWlbqx7e3xATJciI_eO7LsaBFAaFiaR4klLyXhOFPGTEKSJ3C4NlqEveAoXLm16PaINpwYG0cG6sSJgjRuy8xWIC4vSlCQmfkwQTqRaEx7EMuMGQETv_-h03wRfURGYmzQwjq_l5V2XAgfGSQjF6ZKYNnyAwZ0mbc30zmSiccCOV1ali7fWvr0a3g_6nYesIKOAcg-wprD_o032xz9_tZUKqEBWGld7Gy_o_cTYMGV5f3l5cjVpnzt_5E6_yJ05zk52dTLbctuUdsstbyK4ZcLxXl93mBri7GeC1Lf-QDdhCds2Ak70a4DU3wNvNAL-dX9QHa8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yx66UbQ8HLsB4gQ-HrkyVJ6_MmdNXZlNUikWVAquxg1Uk_Vokh_U8D_c8d5Ec1SIZ1PMc7HnuIjmuvy2sFy6q-mvu3yA6W__3IwAA__9TuuRF query T EXPLAIN ANALYZE (DISTSQL) SELECT * FROM kv JOIN kw ON kv.k = kw.k @@ -87,7 +88,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 10 (80 B) +rows read from KV: 10 (80 B, 10 gRPC calls) maximum memory usage: network usage: regions: @@ -110,6 +111,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 5 │ KV bytes read: 40 B +│ KV gRPC calls: 5 │ estimated max memory allocated: 0 B │ missing stats │ table: kv@kv_pkey @@ -123,12 +125,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kw@kw_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsmt9u2zYUxu_3FMS5ale6MiU7TQQUMBZ0QLolGdKiN4MxKNKZLUgWXZG24wV5rL3AnmyQNDf1H1GW0IGspbtIJKXD3zn89IXmI4jPMbjw4d2v7y4_kh_Jz3e31yRakve3VzckWpHbGxItX0fkLYlWryOgkPAAb7wZCnB_BwYUbKDgAIUBUBjCmMI85T4KwdOsy2M-4Cp4ALdPIUzmC5ndHlPweYrgPoIMZYzgwkfvPsY79AJMrT5QCFB6YZy_JlqOouUf8wjXQOGSx4tZIlwSUbIECh_mXnbVs7JAfvlEZDhDl_T_-VsU1z5PJCYy5MleU8pXgqToBS5hxZ37tcTNrXPyE1C4_nR5SYTEOfH5IpHkBT5IK0zkS5f08ziLDohRWYeZ90BmOOPpmnhxzH1PYuCSfv70e0_6UxSEL-R8IV2S9c-j2txgMH6iUFwVPDe87tdk6onpNqlR1n9MQUhvguCyJ9osAWc7CViNotWhBKyeE2CxLgUHUmCXpuD5OTwNMMVg9zmvshcf1etANq8xneB7HiaYWmxnPcX4p3wx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OfcZnUI6k22mZoYX30uj2xgQm10xMfYaLbE2vRwgsVT2wHkjetVVZDYuWZdD2Sav9txhezPnrtVtnAfa_dKmup8svWKqshsfJMuh5Jtf82Qwvro9dulbVo4REmuq2yliq_aq3y3l8Zml61OOMyOcJEt1k2sU6sPK0-wqTGg5vx2TwWv5V-mTa9b2EvE92OWY8gmn2Nw8Q6qTHihghie-fiABSlSxeWbP69uyRGuWYTmeh2zXr2Tj0TO11zPRPtJ9dGQqm24oZ8OVVup9niEFWup9liJlQuvbVMjDi-NhJKtRU3RBD3rqpY6JrHTz_8EwAA__9zlPWP query T EXPLAIN (VEC, VERBOSE) SELECT count(*) FROM kv diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc index c26d85d704e4..eebaf51c9c40 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_misc @@ -104,13 +104,13 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 1,000 (7.8 KiB) +rows read from KV: 1,000 (7.8 KiB, 1,000 gRPC calls) maximum memory usage: network usage: · • create statistics · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzcVtFO4zgUfd-vsO4TSC6JnbSUPMFWrFQhYNVUvKyqlUmuOlFbO2M7Agb1s-YH5stGiSdiyrRJqIqEeKlqX9-ec885ifsM5usSIhhNLi-mlySeXkzH8XQ8iolh5PaGCPLP5PaapMIKoCBVijdihQai_4ABBQ4UAqAQAoU-zCjkWiVojNLlkeeqYZw-QuRTyGRe2HJ7RiFRGiF6BpvZJUIEU3G_xAmKFLXnA4UUrciWFUwJfV5-_J8v8AkojNSyWEkTkZJRnIvya89jRMiUMKLsF9RA4eqO2GyFEfF_fDdunShpUdpMyT9KWj0YolGkEWG-7_bunyzWm0PfJ38Dheu70YgYizlJVCEtOcJH62XSHkfEr4i7A4iLXQcqJFXYvLAOa7am4Na_tD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lO2jKOu5_qdUtGWxtaKnB1fU766ov4-ifs8NPqWiLYutFR0eXNGgu6LBPooGPbd_KEX9bYqyE3-7ov57KOp3VrRlsbWiZ-_6078FeII6l0LjqyvA9id75dUA4wTtPULLQkV4p2RUwdjjbdVXBWLUxmapPYyFTZUE_2ymjc1so5m-bmbNyC3QfmN30NwcvIV3tcVqoSDQPEq1sGbWKKpvQ3mLqRPW0Taz_kbV2SVqzZN1gTXhJrV-I7VB81yDjzvXaSO1YfNcw48711mzi72WF6j59XvTZP7OydhJ0DJZv5xsvvrnVwAAAP__buCuCA== query T retry EXPLAIN (DISTSQL, TYPES) SELECT * FROM data diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze index a1afbd3de4a2..566e62e23b3c 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze @@ -22,6 +22,7 @@ regions: KV contention time: 0µs KV rows read: 0 KV bytes read: 0 B + KV gRPC calls: 0 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey @@ -37,7 +38,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 3 (24 B) +rows read from KV: 3 (24 B, 3 gRPC calls) maximum memory usage: network usage: regions: @@ -50,6 +51,7 @@ regions: KV contention time: 0µs KV rows read: 3 KV bytes read: 24 B + KV gRPC calls: 3 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey @@ -66,7 +68,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 7 (56 B) +rows read from KV: 7 (56 B, 7 gRPC calls) maximum memory usage: network usage: regions: @@ -93,6 +95,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 4 │ KV bytes read: 32 B +│ KV gRPC calls: 4 │ estimated max memory allocated: 0 B │ MVCC step count (ext/int): 0/0 │ MVCC seek count (ext/int): 0/0 @@ -110,6 +113,7 @@ regions: KV contention time: 0µs KV rows read: 3 KV bytes read: 24 B + KV gRPC calls: 3 estimated max memory allocated: 0 B MVCC step count (ext/int): 0/0 MVCC seek count (ext/int): 0/0 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans index cb6e62698850..9810784158e6 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_analyze_plans @@ -64,7 +64,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 10 (80 B) +rows read from KV: 10 (80 B, 10 gRPC calls) maximum memory usage: network usage: regions: @@ -94,6 +94,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 5 │ KV bytes read: 40 B + │ KV gRPC calls: 5 │ estimated max memory allocated: 0 B │ missing stats │ table: kv@kv_pkey @@ -107,12 +108,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kw@kw_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsm29vm7oXx5__XoXlR51GRgykS5EmZav2u-pum0z9M2m6iioazk0RCWTgJO2t-rLuG7iv7ApY1iQkdpx11xT7GWBMDh8fny8-PnnA6bcRdvHFx9OPx5conL0JDeTNhgfh_E34Cv3_vHeGwhn61DvponCOet38FvQOZe3ot_Pe1Wf04Wt-ERs4in3oemNIsfsHJtjAFjawjQ3sYAO3cN_AkyQeQJrGSXbLQ97hxL_DbtPAQTSZ0uxy38CDOAHsPmAa0BFgF196NyM4B8-HxGxiA_tAvWCU_0w464Sz60kI99jAx_FoOo5SF2XWXEy87LBhZlb8_gXRYAwuav7zd1qcD-KIQkSDOCo1JfE8RQl4votIceXmnsLiUht9wAY--3J8jFIKEzSIpxFFB3BHzSCir1zUzI0sbgAIt90w9u7QGMZxco-80SgeeBR8FzXzp994dHALKYqndDKlLsruz61aXCC4_2jg4qyA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yJFe1QMhyqSem1bVWiEOpertMrzFX0-nqkYIUSb13LSq_gpxKFXvmeEt_no6ld0NQTjtEET1Q5SR7t0QUWMosjdoVYTCKG9UpDyjeiI2_P-a6okoM6l2T0QVmciuRMhZO3v3RNQYiooUofJGNTYjRrV7IuRkRNUTIcqknpUIHhQVKULljYpkRHZPhMHpiTBUT0QZqeqJEIcie4NWRSj1bLTgQal694yheiKGj8PH__0bAAD__y5IUsw= # This query verifies stats collection for the hashJoiner, distinct and sorter. query T @@ -122,7 +124,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 10 (80 B) +rows read from KV: 10 (80 B, 10 gRPC calls) maximum memory usage: network usage: regions: @@ -160,6 +162,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 5 │ KV bytes read: 40 B + │ KV gRPC calls: 5 │ estimated max memory allocated: 0 B │ missing stats │ table: kv@kv_pkey @@ -173,12 +176,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kw@kw_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsm9Fuo0YUhu_7FKO52qh4YQbsOEgrRZukarbduEqilarKqghMYwQGLzOOk0Z5rL5An6wCl_XamDkm2Yaph7vYgHPmO2fOP_wDj5h_jrGLr85-Pju5RqfnV9fnFyfX6E20eLs4QD9cjj6i6A59GJ1foGiBRhcounsboXcoP45Gl6dnl-j9r8UnbOAkDdiFN2Ucu79hgg1MsYFtbGAHG7iPxwaeZanPOE-z_JTH4oLz4B67loHDZDYX-ddjA_tpxrD7iEUoYoZdfO3dxOySeQHLTAsbOGDCC-Pi30R3x9Hd77OIPWADn6TxfJpwF0XYwFczL_-zZ-ZR_PQJiXDKXGT9_RdffvbTRLBEhGlSOZSlC44y5gUuIstvbh4EK78aovfYwB8_nZwgLtgM-ek8EegNuxdmmIgDF1lFkMsTGIvqTph692jKpmn2gLw4Tn1PsMBFVvHr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xxlgGYCFwPNUwbKP62ewYVSdXTooBA0dKjIDUPfLOi2kBFFdvFAx0bdgJ4YVqmmRgTPace4K03uyJqvMdAed62g6Hk5NezHak54Z2HAWCi53cbYkwE1ogiFRHI87ZtjHYqIgBK2z5GO5kuXt4jA6Dtri3wdUYGgImen29AoDS3I4q4O-L4NTUyAFD0fJuqrR1uVtRToKLW3PbOyCA1t70zMgBM2p56KuaJnp93QJNHqXWVA-LX0siwZfbNafIqA2DStpHRSkUEMNHzGw9o8jS7I2pURCh-LY0MW7x-aAPrh3Zt_bAzMgBM9DQyIFD0bEfEoAjcETXcHSj-tt-m2iG1toK4WVFdoKKKd51oaWTYNbddKSNDRUz0nHpiTPQ0MqDJo2c7AoCi1LrKrviBJQQtX9rFmLRtZLST58D6oZ5GBjB52v7MQ0lQmt0RRSqieP3QBtYPbfFuHT2NDGCnm56dAwCKnkYGsNdNy888IFCU2vS_q58Sb9ZzgM16Ts1u19DImDz-7-8AAAD__52jJao= # This query verifies stats collection for WITH ORDINALITY and the hashJoiner. query T @@ -188,7 +192,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 10 (80 B) +rows read from KV: 10 (80 B, 10 gRPC calls) maximum memory usage: network usage: regions: @@ -213,6 +217,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 5 │ KV bytes read: 40 B +│ KV gRPC calls: 5 │ estimated max memory allocated: 0 B │ missing stats │ table: kv@kv_pkey @@ -231,12 +236,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzsUcFu00AQvfMVozkBWhTbcTjsySUUNdA2KImKEIrQxjtKLdu77u46JIryWfwAX4bspaJJm7QBceM4b-bNvHlvjfamQI7j0_PT_gRewrvR8ALyBXwaTM5gOHo7uDw5H0w-w8kYBNvTmCFDpSVdipIs8i8Y4pRhZXRK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a-R7fv2oV01PXtbgKOyApnZHGor5vTkVUb7I-sds8sR2UorS7vRPfpy0ORFck4-f6trk9KV0Wk7xpfDVtcCkqzz3dAXA-VbjcH74vCgON4Sh7vi6KC4e3hy94jJ0a44Piju7Uyebv77EQAA__9ztVux # Verify that EXPLAIN ANALYZE on an unsupported query doesn't return an error. statement ok @@ -267,7 +273,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 5 (40 B) +rows read from KV: 5 (40 B, 5 gRPC calls) maximum memory usage: network usage: regions: @@ -287,12 +293,13 @@ regions: KV contention time: 0µs KV rows read: 5 KV bytes read: 40 B + KV gRPC calls: 5 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzslcuO0zAUhvc8xdFZtZKrJL0glNVANaARDEWdUVmgCnnio2IlsTO20wujPhYvwJOhOBOYdi6k63bXc_nt469_dO7Q3mYY49X5p_PxNfDlopN2YTI7n0KnC--nk0tIl8hQaUGfeU4W428YIcM-MhwgwyEyHOGcYWF0QtZqU7XcecGFWGMcMpSqKF2VnjNMtCGM79BJlxHGeM1vMpoSF2SCEBkKclxm_pp0eZYuvxcpbZDhWGdlrmwMKTK8Knj1sxdUU3ycgZM5xRD-_mXrONHKkXJSq0clo1cWDHERQ1RnbjaOmtQbeIcML2fjMVhHBSS6VA46tHaBVK4bQ-iHrBuI0ucacr6GnHJtNsCzTCfckYgh9KffcJf8IAu6dEXpYqj6_VRNIsL5lmEd3VOzji8I42jLniH7D2iptBFkSOzAnG-fYP9VKqFXZILRLvi3sw-ds6iLDCfVPGcVZVpTUj4m-tJDq5q9zcBRXoCQNoXS8gW15jB6lkN_h0PU3mHRgQ4L-r1gcMwe67dn2z-U7aAXDI-Z7aA928GhbIc9_1EfLdthe7bDQ9mOesdM9j_7fEq20MrS3vZ5-uSw2kokFlSvMKtLk9AXoxN_TR1OvM4nBFlXV6M6uFC-5Ad8KI5eFL_eEYf74v4hN_un-FehIrfSJoWMO1LJ5u_f3-RXXLpdYwiyZCTP5E_-2DWN7N46Cckl3dunKTUeamq1j5pqTrZatw8bwtZG2EUyOCHZRzI8IdlHMjoh2c63r_4EAAD__1b2Y4s= +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzslU1u2zwQhvffKQazsgEakvzzodAqrZEWQZs6cAJ3URgFIw5cQRKpkJR_GvhYvUBPVoiKmsixA3mvnTkzr2f48BXmEc1DiiHeXn65nN4BX696SR9mi8s59PrwcT67hmSNDKUS9JVnZDD8jgEyHCLDETIcI8MJLhnmWkVkjNJlyaMTXIkthj7DWOaFLcNLhpHShOEj2timhCHe8fuU5sQFac9HhoIsj1PXJllfJOsfeUI7ZDhVaZFJE0KCDG9zXv4ceOUUnxdg44xC8P_8NtU5UtKStLGSr1JabQxo4iKEoIrc7yzVoXfwoQqu5jdTiHiamqruejGdgrGUQ6QKaaFHW-vF0vZD8N3cVQFRcqog41vIKFN6BzxNVcQtiRB81_Ce2-gnGVCFzQsbQlnvBq0DAS73DKvTE0hj-YowDPbsBOxnxoVUWpAm0eC73B95jm-xFGpD2ps03-L94lPvIugjw1k5z0UJnrYUFa8hv3XRMmceUrCU5SBik0Bh-Ipac5ic5DBscAjamy4403TecOCNOts1cA_b4x6ei3s08MYd7gbuUXvco3Nxjwfu0-9wP-Met8c9Phf3ZNDBPrnBjsCek8mVNHSwyY7_s19uOBIrqtahUYWO6EaryLWpjjOncwFBxlbZoDpcSZdyA74UB2-K_2-I_UPx8JzO7iruVijJbpROIOWWZLT754g6vuGxbXpFkCEd8zT-xV8bqZY9uSmieE1PjqpTta3qXGWtOpuRKVf3ywK_tRGaSEYdkkMk4w7JIZJJh2S_3P_3NwAA__9s1n2e # Very simple query to make it easier to spot regressions when rewriting results # in test files. @@ -315,12 +322,13 @@ regions: KV contention time: 0µs KV rows read: 0 KV bytes read: 0 B + KV gRPC calls: 0 estimated max memory allocated: 0 B missing stats table: kv@kv_pkey spans: [/0 - /0] · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMUdFq4zAQfL-vWPbpDgRxXgUHxxmXhjZNcUL6UExR5CU1siVXWqcJwZ_VH-iXFVshpZRA3zSzM7PL6IjhpUaJy-w2S1dg4CpfzMHs4OE6yzMw8BcSFGhdSXeqoYDyEadYCGy90xSC8wN1HAWzco8yEVjZtuOBLgRq5wnlEbnimlDiSm1qykmV5CdDcEmsqnqMNbt_ZvfUGjqgwNTVXWODBIMCl60anpNktNysgauGJCTvbyFi7SyT5crZbyPvXgN4UqWEk3lzYDpT8B8FztdpCoGpBe06y_Cb9jypLP-REFdGAZG5JGjUHhpqnD-AqmunFdM5faNYP1MA13HbcTxjvOqTKHqBEZ1qC6y2hHLai59Xm1NonQ30pdVLyUlfCKRyS_H7guu8pnvv9LgmwsXoG4mSAsfpNIKZjaO-6H99BAAA__9qHbnN +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkc-K2zAQxu99imFOLQjiXAWFUuPS0KYJTkgPxRRFHlIjWXKlcTYh-LH2BfbJFlshy7IE9qbvN9_84dMF43-LEjfFzyLfgoFv5WoJ5gi_vxdlAQY-Q4YCna_pl2opovyDc6wEdsFritGHEV0mw6I-ocwENq7recSVQO0DobwgN2wJJW7V3lJJqqYwGwfXxKqx01hz_GKOfztDZxSYe9u3LkowKHDTqfE5y6aWHzvgpiUJ2dNjTFp7x-S48e5NKfiHCIFULeHavD8z3RB8TfBQrnPQytqYfMtdnkNk6kD73jF8pBPPGsefJKQrkoHI3DO06gQttT6cQVnrtWK6Ldwr1v8ogu-56zltnA59AdUgMKlrkpHVgVDOB_H-tEuKnXeRXgV9b3I2VAKpPlD60ej7oGkdvJ7WJLma-iZQU-RUnSexcKk0VMOH5wAAAP__L2C_Aw== # Test a query that has a subquery and a postquery. statement ok @@ -335,7 +343,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 2 (16 B) +rows read from KV: 2 (16 B, 2 gRPC calls) maximum memory usage: network usage: regions: @@ -372,6 +380,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B +│ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ missing stats │ table: parent@parent_pkey @@ -393,6 +402,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B + │ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ table: parent@parent_pkey │ equality: (column2) = (p) @@ -411,6 +421,6 @@ regions: actual row count: 1 label: buffer 1 · -Diagram 1 (subquery): https://cockroachdb.github.io/distsqlplan/decode.html#eJysU9Fq20oQfb9fMcyTDRssOVwo-5TUuGDiyMV2DKWYsFkNyhJpV90dNXaDP6s_0C8rkqw2IsRtaZ_sPTNn9szZoycMn3KUOEtW0-UaZsl6Afre5ClsLuc30xUMYgGD1XQ-nayhMHZQDuHdcnENpfJkeThEgdallKiCAsqPGKPA_3ErsPROUwjO1_BT0zRLdygjgcaWFdfwVqB2nlA-IRvOCSUm7syVozEKTImVyZuhtCNdsXEW2BQkIfr2NaDAO8X6ngK4isuKJUQo0LvHn0CM24PA9nS8L7DKCOX5QTzTFJ_WtFZ3OS1JpeRHUV9Za8NF-3NbPtAeBU5cXhU2SChR4KpU9d8zFDg3hWGoHbra9De52oB2lsm-XPJqA81OnlQqO_LdnqmD3sBbFHi9mUwgMJWgXWUZBrTjkbE8lBA1otsGoofXGgq1g4IK5_eg8txpxZRKiJrpf-F0_CdOX2aZp0yx86O4b_Rl8uE2Waxvk5v5fHAR17n796kY97T-IqlLCqWzgXo6X5scHbYCKc2o_RqCq7ym997p5pr2uGh4DZBS4LZ63h5mti3VAp-T45Pk8Wny-CQ56pObVZqt0BI_Ov8AuWKyev_D-Q5_VIb7b5JSIG9Ubr6olw_W0Y4x12Q-0zHqXanLe1drM99VCwpBZb2G6HeDsD389z0AAP__LpmnwQ== +Diagram 1 (subquery): https://cockroachdb.github.io/distsqlplan/decode.html#eJysU9Fq2zAUfd9XXO5TAiqxUwbDT-1CBqGpU5I0MEYoqnxxRW3Jk67XZCWftR_Ylw1b9VZTmm1sT7bOvUe65-joEf3nAhOcpavpcg2zdL0AdaeLDDbn8-vpCgaxgMFqOp9O1lBqM6iG8GG5uIRKOjI8HKJAYzNKZUkek08Yo8C3uBVYOavIe-sa-LFtmmU7TCKB2lQ1N_BWoLKOMHlE1lwQJpjaE1uNxigwI5a6aDelHamatTXAuqQEou_fPAq8lazuyIOtuao5gQgFOvvwC4hxexAYVk_neZY5YXJ6EM9mio_PtJa3BS1JZuRGUX-yYMNZ-NxU97RHgRNb1KXxCVQocFXJ5vcEBc51qRkahy42fSUXG1DWMJmXIi820GpyJLOkI9_umTroHbwPYL68moCSReFD3-VmMgHPVIGytWEY0I5H2vAwgajVERqI7l9rKOUOSiqt24MsCqskU5ZA1B74D-bHf2P-eZ47yiVbN4r73p-nH2_SxfomvZ7PB2dxE8X_H5Rxb9bfhHdJvrLGU2_O13aODluBlOUUHoi3tVN05axqjwnLRctrgYw8h-ppWMxMKDUDPifHR8nj4-TxUXLUJ7dSWlVoiB-su4dCMhm1_-l8hz9Izf07yciT07LQX-XLC-toT8lXpL_QU_q7UvcEulp4Bl21JO9l3muI_jQI28ObHwEAAP__GAys-A== Diagram 2 (main-query): https://cockroachdb.github.io/distsqlplan/decode.html#eJyMj89K80AUxfffU1zOqoWBL9nOTiRCoLbSVjeSRZxc2oF0bpy5wULJY_kCPpk0I4gLweX53Tl_5oL02sOiXu-q7Z7q9X5D7uj7jp5uVo_VjhalocWuWlW3ezr5sBiWdLfd3NPQRg66XMIgSMfr9sQJ9hklGoMhiuOUJF7RZX5Qd2fYwsCHYdQrbgycRIa9QL32DIteXNuTkzEoFf8LGHSsre_nYD6zG9VLIPUntlR8vCcYvLTqjpxIRh1GtXR1RXn7BiWaySCrr96k7YFhy8n8fduW0yAh8Y9RvyUXU2PA3YHz_5OM0fFDFDfXZLmZfTPoOGm-llnUIZ-mZvr3GQAA__9Sm4hi -Diagram 3 (postquery): https://cockroachdb.github.io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BHLlBug8YdQ7nKWQLyGcF5HfT6X_hHZ7Ce2WVmZMoyQ2G-8TFpiYO08llARd5kcHVLMuRYQz4PP58qp9pgwyn1j43NXy2yoA17SmR4djqpjKeQ407BmhP0KK_1j4IrfcPfr18U0trApm3d3S97AaCI1HGqddLuN8EepXew4coPs5vxyCF1rvdb5bjMfhANUjbmAA9WoeBMqHPd08rNhA9H2o4EFsl1lBRZd0GhG7fbaCSQ9Jx_DHS5GCko1MijX8Xcs46UA_xitLBaD_df312hxnPTmGck6-t8bQHdWhysl0xpPKR4mfD28ZJunVWdtvEctb5OqEkH-JqGovMxKUW8FdzetQ8PG4eHjWPjptHR81nv5lX23c_AgAA__-iNtJQ diff --git a/pkg/sql/opt/exec/execbuilder/testdata/inverted_index_geospatial b/pkg/sql/opt/exec/execbuilder/testdata/inverted_index_geospatial index 208add211272..cd854fe15081 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/inverted_index_geospatial +++ b/pkg/sql/opt/exec/execbuilder/testdata/inverted_index_geospatial @@ -26,7 +26,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 6 (48 B) +rows read from KV: 6 (48 B, 6 gRPC calls) maximum memory usage: network usage: regions: @@ -53,6 +53,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 2 │ KV bytes read: 16 B + │ KV gRPC calls: 2 │ estimated max memory allocated: 0 B │ estimated max sql temp disk usage: 0 B │ table: geo_table@geo_table_pkey @@ -74,12 +75,13 @@ regions: KV contention time: 0µs KV rows read: 4 KV bytes read: 32 B + KV gRPC calls: 4 estimated max memory allocated: 0 B missing stats table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzMVeFu40QQ_s9TjOZPG2GUXdsNuUVIoTkfBOjl5ESHTjiKXHvIWbF3fbtrcFXlsXgBngzZbk_NhbhNEejyw8nM7LeZ-b791rdoPuQocBH8HEyXsIVX4fwKNqTWNr7OCX75IQgDMHadSUvaUGLN-dkinL381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ZQ3KArXUUo8KLvMSVZkJkwDLAgJ8tqWPbdFuZ9A5elKqjDABe6amtlBWx9ZxjgeSN7YJLhSZZ1fxRZ1nGWZR372AO_2ZfDMwSpCogYaPeGjMUAf3kFrqxJAPvn77s418qRcqVWj1JG_2XBkCwExB65unZ0D0UhnHh0k54tIJdVZX3h6avFAqyjBnLdKgeH1LlJqdyRADaMzhcQbZ8qqGUHNdXaXIOsKp1LR4UANrzwSrr8DVnQrWtaJ6CvHzq9B2Jc3wboozstrZMbQsFvg0_Xe6n-JOOoeFFWjgyZCd8V_T6fdI0BrWDOBdheXrBOGicGuaJvj7OMhSzLGPvYA4FUsS-tV_mRzKt-DPO-32GDg5BeGh9bJ6tqV27qKG8fn4IxIfqcfVuBo7qBorRbaK3c0CfrFD6pU7iPTj_rUt3ZMhyxpf912Wzp-sPW_GxvhI-9wacf8kb4xb3x5SSJ9pHknWWiXUE8Lt6_4hlnvL_MQxZOp8_Yw89i-gOfxdwHMzbjszhOYn4gHt768_DoyUMffsah_w9jivcZ07k2jswk3h3SnH_9f_Pj8T67Ssk2Wlna2dVTK7PbdYBUbMj_F1vdmpzOjM6H1_hwNfAGoCDrfJb7YKl8qm_wIZmPksNxcjhKjsbJ0Sg5HifHo-Tj98jr26_-DQAA___vrPo- statement ok DROP TABLE geo_table @@ -111,7 +113,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 4 (32 B) +rows read from KV: 4 (32 B, 4 gRPC calls) maximum memory usage: network usage: regions: @@ -138,6 +140,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 2 │ KV bytes read: 16 B + │ KV gRPC calls: 2 │ estimated max memory allocated: 0 B │ estimated max sql temp disk usage: 0 B │ table: geo_table@geo_table_pkey @@ -159,12 +162,13 @@ regions: KV contention time: 0µs KV rows read: 2 KV bytes read: 16 B + KV gRPC calls: 2 estimated max memory allocated: 0 B missing stats table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUleGO20QQx7_zFKP5chdhlF3bF9JFSOFSFwJcUzlRUYWjyGcPqRV7191dg0-nPBYvwJOhte-qS48aIg6J5sMmM7P_zcz8POtbNO9KFLiKfozma9jDi3h5BTtSW5telwQ_fRfFERi7LaQlbSiz5vxsFS-ef-1PnvHpV6-Wi5fr85AxxgLovlgwOhPi22h5Fa3jN547qxrBMn4exXD5BvbooVQ5vUwrMih-Ro4bD2utMjJGaee67TYs8hYF87CQdWOde-NhpjShuEVb2JJQ4NrlGFOakx4z9DAnmxZld-z7EmYugW0hc2rRw7kqm0oaAfs-M_RwVafOMU7wMknaX_IkaVngFvY3C35xqoYnCKnMIWCg7FvSBj384TXYoiIB7I_f7-xMSUvSFko-Cmn1mwFNaS7A7z3XN5buXXwCl-jh1ev5HIylGjLVSAvn1NpxIe1IAOv61G8g2n9sQ5W2UFGl9A2kZamy1FIugHWnX6c2e0sGVGPrxgpw-7u07h0-bg4e9tYdOGPTHaHgB--fw13IX0lbyl8UpSVNesyPCd_Ho7bWoCTMuADjWIKxqbaiYxN8eZEkzLFhDsHggkAyP1XmkD5iunRtmLl8uwI7aj2w3jY2LctjttRS1jxGPgTCxcy7EixVNeSF2UNj0h09ASf_FE7fq0LezaA_MIP9r229p5u_nsNPbhD-u_4Hp_T__XwEx93v_eLDy5txxt017TN_MnnGHn7mk2_4NOS9MWVTPg3DKORn4uF9PvNHT_qE_4s2hae0aaW0JT0Oj5s045__34bv4pSqYjK1koaOqvrYyeyw8ZDyHfVvWaMandErrbLub3pz2ek6R07G9lHeGwvZh1yCD8V8UOwPi_1BcTAsDgbF4bA4HBRffCDeHD77MwAA__8yoe_O +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzclf9u2zYQx__fUxzunySYBpOS4rkcBnhx1c3bUgdK0KGYjYCRbq5gmVRJalMQ-LH2AnuygWJSxM2qzVgHDPUftO_HlzreR0ffoX1bo8DL7MdsdgUbeJEvzmFN-trJm5rgp--yPAPrrivlyFgqnD0-usznz7-Ox8_45KuLxfzl1XHKGGMJ9F8sOTkS4ttscZ5d5a8jv9f2BBb58yyHs9ewwQiVLuml3JJF8TNyXEXYGF2Qtdp4112fMC87FCzCSjWt8-5VhIU2hOIOXeVqQoFXvsacZElmxDDCkpys6n7bd0eY-gKuK1VShxHOdN1ulRWwCZVhhJeN9I7REs-Wy-6XcrnsWOIX9jcLfnGohi8RpCohYaDdGzIWI_zhFbhqSwLYH7_f24VWjpSrtHoSMvo3C4ZkKSAOnptbRw8uPoaz4F3nFzMoZF3bkHj-ajYD66iBQrfKwTF1blQpdyKA9a0LCUSbDyVsZQdb2mpzC7KudSEdlQJY_8Ab6Yo3ZEG3rmmdAJ_fV_rgiHG1izBY9yytk2tCwXfRP-c9V7-ScVS-qGpHhsyI70N_iGddY0ArmHIB1uMF66RxoseVfHm6XDKPi3kqgwsCqfJQmaf8BPPCt2Hq6-0P2IMMaIJtnazrfdzUUdE-fQuGQPiYfVuDo20DZWU30Fq5po_AKT6E0_e6UvdjGQ-MZfh13Wzo9q9H81OYjf8OSXIIkncjk-wDCX7x_hXPOOP-Mo9ZPB4_Y48_s_E3fJLyYEzYhE_SNEv5kXh860_jk4_60v-LNqWHtOlSG0dmlO43aco__7_N4-khp8rJNlpZ2jvVh3Zmu1WEVK4p_Bdb3ZqCLowu-scEc9HrekdJ1oUoD8ZchZAv8LGYD4rjYXE8KE6GxcmgOB0Wp4Pi0_fEq91nfwYAAP__9CH6Pg== # Also works when creating an index. statement ok @@ -180,7 +184,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 4 (32 B) +rows read from KV: 4 (32 B, 4 gRPC calls) maximum memory usage: network usage: regions: @@ -207,6 +211,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 2 │ KV bytes read: 16 B + │ KV gRPC calls: 2 │ estimated max memory allocated: 0 B │ estimated max sql temp disk usage: 0 B │ table: geo_table@geo_table_pkey @@ -228,9 +233,10 @@ regions: KV contention time: 0µs KV rows read: 2 KV bytes read: 16 B + KV gRPC calls: 2 estimated max memory allocated: 0 B missing stats table: geo_table@geom_index spans: 31 spans · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzUleGO20QQx7_zFKP5chdhlF3bF9JFSOFSFwJcUzlRUYWjyGcPqRV7191dg0-nPBYvwJOhte-qS48aIg6J5sMmM7P_zcz8POtbNO9KFLiKfozma9jDi3h5BTtSW5telwQ_fRfFERi7LaQlbSiz5vxsFS-ef-1PnvHpV6-Wi5fr85AxxgLovlgwOhPi22h5Fa3jN547qxrBMn4exXD5BvbooVQ5vUwrMih-Ro4bD2utMjJGaee67TYs8hYF87CQdWOde-NhpjShuEVb2JJQ4NrlGFOakx4z9DAnmxZld-z7EmYugW0hc2rRw7kqm0oaAfs-M_RwVafOMU7wMknaX_IkaVngFvY3C35xqoYnCKnMIWCg7FvSBj384TXYoiIB7I_f7-xMSUvSFko-Cmn1mwFNaS7A7z3XN5buXXwCl-jh1ev5HIylGjLVSAvn1NpxIe1IAOv61G8g2n9sQ5W2UFGl9A2kZamy1FIugHWnX6c2e0sGVGPrxgpw-7u07h0-bg4e9tYdOGPTHaHgB--fw13IX0lbyl8UpSVNesyPCd_Ho7bWoCTMuADjWIKxqbaiYxN8eZEkzLFhDsHggkAyP1XmkD5iunRtmLl8uwI7aj2w3jY2LctjttRS1jxGPgTCxcy7EixVNeSF2UNj0h09ASf_FE7fq0LezaA_MIP9r229p5u_nsNPbhD-u_4Hp_T__XwEx93v_eLDy5txxt017TN_MnnGHn7mk2_4NOS9MWVTPg3DKORn4uF9PvNHT_qE_4s2hae0aaW0JT0Oj5s045__34bv4pSqYjK1koaOqvrYyeyw8ZDyHfVvWaMandErrbLub3pz2ek6R07G9lHeGwvZh1yCD8V8UOwPi_1BcTAsDgbF4bA4HBRffCDeHD77MwAA__8yoe_O +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzclf9u2zYQx__fUxzunySYBpOS4rkcBnhx1c3bUgdK0KGYjYCRbq5gmVRJalMQ-LH2AnuygWJSxM2qzVgHDPUftO_HlzreR0ffoX1bo8DL7MdsdgUbeJEvzmFN-trJm5rgp--yPAPrrivlyFgqnD0-usznz7-Ox8_45KuLxfzl1XHKGGMJ9F8sOTkS4ttscZ5d5a8jv9f2BBb58yyHs9ewwQiVLuml3JJF8TNyXEXYGF2Qtdp4112fMC87FCzCSjWt8-5VhIU2hOIOXeVqQoFXvsacZElmxDDCkpys6n7bd0eY-gKuK1VShxHOdN1ulRWwCZVhhJeN9I7REs-Wy-6XcrnsWOIX9jcLfnGohi8RpCohYaDdGzIWI_zhFbhqSwLYH7_f24VWjpSrtHoSMvo3C4ZkKSAOnptbRw8uPoaz4F3nFzMoZF3bkHj-ajYD66iBQrfKwTF1blQpdyKA9a0LCUSbDyVsZQdb2mpzC7KudSEdlQJY_8Ab6Yo3ZEG3rmmdAJ_fV_rgiHG1izBY9yytk2tCwXfRP-c9V7-ScVS-qGpHhsyI70N_iGddY0ArmHIB1uMF66RxoseVfHm6XDKPi3kqgwsCqfJQmaf8BPPCt2Hq6-0P2IMMaIJtnazrfdzUUdE-fQuGQPiYfVuDo20DZWU30Fq5po_AKT6E0_e6UvdjGQ-MZfh13Wzo9q9H81OYjf8OSXIIkncjk-wDCX7x_hXPOOP-Mo9ZPB4_Y48_s_E3fJLyYEzYhE_SNEv5kXh860_jk4_60v-LNqWHtOlSG0dmlO43aco__7_N4-khp8rJNlpZ2jvVh3Zmu1WEVK4p_Bdb3ZqCLowu-scEc9HrekdJ1oUoD8ZchZAv8LGYD4rjYXE8KE6GxcmgOB0Wp4Pi0_fEq91nfwYAAP__9CH6Pg== diff --git a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join_limit b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join_limit index 7ca8803cae48..476d13edf355 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/lookup_join_limit +++ b/pkg/sql/opt/exec/execbuilder/testdata/lookup_join_limit @@ -78,7 +78,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 2 (16 B) +rows read from KV: 2 (16 B, 2 gRPC calls) maximum memory usage: network usage: regions: @@ -102,6 +102,7 @@ regions: │ │ KV contention time: 0µs │ │ KV rows read: 1 │ │ KV bytes read: 8 B + │ │ KV gRPC calls: 1 │ │ estimated max memory allocated: 0 B │ │ estimated max sql temp disk usage: 0 B │ │ table: a@a_pkey @@ -114,6 +115,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B + │ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ missing stats │ table: a@a_y_idx @@ -127,6 +129,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 0 │ KV bytes read: 0 B + │ KV gRPC calls: 0 │ estimated max memory allocated: 0 B │ estimated max sql temp disk usage: 0 B │ table: a@a_pkey @@ -139,6 +142,7 @@ regions: KV contention time: 0µs KV rows read: 0 KV bytes read: 0 B + KV gRPC calls: 0 estimated max memory allocated: 0 B missing stats table: a@a_y_idx @@ -156,7 +160,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 2 (16 B) +rows read from KV: 2 (16 B, 2 gRPC calls) maximum memory usage: network usage: regions: @@ -180,6 +184,7 @@ regions: │ │ KV contention time: 0µs │ │ KV rows read: 1 │ │ KV bytes read: 8 B + │ │ KV gRPC calls: 1 │ │ estimated max memory allocated: 0 B │ │ table: a@a_pkey │ │ @@ -191,6 +196,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B + │ KV gRPC calls: 1 │ missing stats │ table: a@a_y_idx │ spans: [/1 - /1] @@ -203,6 +209,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 0 │ KV bytes read: 0 B + │ KV gRPC calls: 0 │ estimated max memory allocated: 0 B │ table: a@a_pkey │ @@ -214,6 +221,7 @@ regions: KV contention time: 0µs KV rows read: 0 KV bytes read: 0 B + KV gRPC calls: 0 missing stats table: a@a_y_idx spans: [/2 - /2] @@ -307,7 +315,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 2 (16 B) +rows read from KV: 2 (16 B, 2 gRPC calls) maximum memory usage: network usage: regions: @@ -320,6 +328,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B +│ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ count: 1 │ @@ -331,6 +340,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B + │ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ table: b@b_pkey │ equality: (x) = (x) @@ -344,6 +354,7 @@ regions: KV contention time: 0µs KV rows read: 1 KV bytes read: 8 B + KV gRPC calls: 1 estimated max memory allocated: 0 B estimated row count: 1 (100% of the table; stats collected ago) table: a@a_y_idx diff --git a/pkg/sql/opt/exec/execbuilder/testdata/prepare b/pkg/sql/opt/exec/execbuilder/testdata/prepare index 509586b6ff6d..5a65d5edf1d6 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/prepare +++ b/pkg/sql/opt/exec/execbuilder/testdata/prepare @@ -115,7 +115,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 1 (8 B) +rows read from KV: 1 (8 B, 1 gRPC calls) maximum memory usage: network usage: regions: @@ -128,6 +128,7 @@ regions: KV contention time: 0µs KV rows read: 1 KV bytes read: 8 B + KV gRPC calls: 1 estimated max memory allocated: 0 B estimated row count: 0 table: ab@ab_pkey @@ -152,6 +153,7 @@ regions: KV contention time: 0µs KV rows read: 0 KV bytes read: 0 B + KV gRPC calls: 0 estimated max memory allocated: 0 B estimated row count: 0 table: ab@ab_pkey diff --git a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local index 39bd57b13d19..3f61148a96e2 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local +++ b/pkg/sql/opt/exec/execbuilder/testdata/vectorize_local @@ -42,7 +42,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 2,001 (16 KiB) +rows read from KV: 2,001 (16 KiB, 2,001 gRPC calls) maximum memory usage: network usage: regions: @@ -55,12 +55,13 @@ regions: KV contention time: 0µs KV rows read: 2,001 KV bytes read: 16 KiB + KV gRPC calls: 2,001 estimated max memory allocated: 0 B missing stats table: a@a_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkcFq4zAQhu_7FMOcdkFL5D3sQadlTQohTVOSkEsxRZGG1MSWXGlME4Ifqy_QJyuWmkMpgd483_z-5-fXGeNzgwrX09tpuQENN6vlAjQKdN7SnW4ponrAAiuBXfCGYvRhROckmNkjKimwdl3PI64EGh8I1Rm55oZQ4UbvGlqRthQmEgVaYl03yVb_04_dgU4osPRN37qo0u11p8fP3yhwvgWuW1Ig315jno13TI5r776sgn-JEEhbBX-ElEWmuxPTBRd_YV7_R4GLbVlCZOrA-N4x_KQjT2rHvxTIlDMLiA7XBK0-QkutDyfQTeONZrIKJIzuO83miSL4nrueFYz6FO4CcrxqEJjJR3mR9Z5QFYP4fsErip13kT51e81ZDpVAsnvKjxh9HwzdB2_SmTwu038JWIqct0UeZi6vhmr48R4AAP__2AW3Pg== +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkcGKFDEQhu8-RVEnhcimPXjISWxWWNZ1l95hLtJITVKMzaSTNqnGGYZ-LF_AJ5NOHERkwFvXV3_X__PnjPmbR4PPtx9v2w0QfOgeH4BQYYiOP9HIGc1nbLBXOKVoOeeYVnQugjt3RKMVDmGaZcW9QhsTozmjDOIZDW5o57ljcpxuNCp0LDT4cpbe0ZfpwCdU2EY_jyGb4v080fr5GhXeb0GGkQ3onz9ynW0MwkGGGP5Zpfg9Q2JyBt4orZtKdyfhC27ewv3wvvJ999SCJe_zH_nDtm0hC09g4xwEXvJRboYgrwzoEr8KmA_XBCMdYeQxphOQ99GSsDOgYTXdkdivnCHOMs1iYNWXzBdQY_SLwkp-d5qF9oymWdT_995xnmLI_Ffl1y7rpVfIbs_1bXOck-WnFG2xqeNj-a8Ax1nqtqnDXairpV9e_AoAAP__tLm9Mw== query T EXPLAIN ANALYZE (DISTSQL) SELECT c.a FROM c JOIN d ON d.b = c.b @@ -69,7 +70,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 3 (24 B) +rows read from KV: 3 (24 B, 3 gRPC calls) maximum memory usage: network usage: regions: @@ -82,6 +83,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 1 │ KV bytes read: 8 B +│ KV gRPC calls: 1 │ estimated max memory allocated: 0 B │ table: d@d_pkey │ equality: (b) = (b) @@ -94,12 +96,13 @@ regions: KV contention time: 0µs KV rows read: 2 KV bytes read: 16 B + KV gRPC calls: 2 estimated max memory allocated: 0 B estimated row count: 1 (100% of the table; stats collected ago) table: c@sec spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0k99q1EAUxu99isO5Uhi3SS5EBoTFpcLWdiPb0hsJMpk51LjJnJg5wV2WfSxfwCeTzLTQulRU7OX3zfnH72P2GL62qPHy9Px0cQV2ZuDdurwAC2flcgUOyhW4WQ1vwM5qVOjZ0cp0FFB_xBwrhf3AlkLgYbL2sWDptqgzhY3vR5nsSqHlgVDvURppCTVembqlNRlHw0mGCh2Jado41s4DWVS44HbsfNBgFEy7L3szqZeo8P01SNORhuzH95C0ZS_kpWF_9DTwtwADGaehSE69E7qz8lfwFhVeXC8WEIR6sDx6gee0lZPGywsNWbwwFRBtHivozBY66njYgWlbtkbIacji9NqI_UwBeJR-FA1TfTzrziiwOihM6hZZEHNDqPOD-nOsZ9z4W6r5Q6pu7j71G9qhwnPmzdjDF248sNcwL-7TnlCX00nzaUJcFgkmeEkHMW17xPnfIsmPI3n9nxKhLdnxeP8TBVX8TVBrCj37QA9CemxydqgUkruh9McCj4OlDwPbuCbJMvZFw1GQ9JonsfTpaTrwfnP-2-bil-bq8OxnAAAA__-PPFhI +Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJy0U9Fq1EAUffcrLvdJYdwmeRAZEBZDha3tpmxLXyTIZOayxp3MjZkJ7rLsZ_kDfplkpoXWtaJiH8-Zc-89nMPs0X-xKPHq9Py0vAY9U_BuVV2AhrNqsQQD1RLMrIE3oGcNCnRsaKk68ig_YI61wH5gTd7zMFH7KFiYLcpMYOv6MUx0LVDzQCj3GNpgCSVeq8bSipSh4SRDgYaCam1cq-eeNAos2Y6d8xKUgOn2Va8m9BIFvr-B0HYkIfv-zSes2QVyoWV39DTwVw8DKSOhSEyzC3RH5a_gbWLXq8sStLLWJ-HFTVmCD9SD5tEFeE7bcNK68EJCFk0nAdHmMUGnttBRx8MOlLWsVSAjIYsHGxX0J_LAY-jHIGHSR6d3RIH1QWBCtyn6oNaEMj-IP0_6jFt3G3T-MGgzNx_7De1Q4DnzZuzhM7cO2EmYF_cLmNKvJkvzaUM8FkNNMSXsg7L2KPp_ayk_bun1r0rK_0tJtCU9Hlt6ou6Kv-luRb5n5-lBb49tzg61QDJrSj_R8zhouhxYxzMJVnEuEoZ8SK95AguXniaD94fz3w4XPw3Xh2c_AgAA__-952K3 query T EXPLAIN (OPT, VERBOSE) SELECT c.a FROM c INNER MERGE JOIN d ON c.a = d.b @@ -149,7 +152,7 @@ planning time: 10µs execution time: 100µs distribution: vectorized: -rows read from KV: 4 (32 B) +rows read from KV: 4 (32 B, 4 gRPC calls) maximum memory usage: network usage: regions: @@ -179,6 +182,7 @@ regions: │ KV contention time: 0µs │ KV rows read: 2 │ KV bytes read: 16 B +│ KV gRPC calls: 2 │ estimated max memory allocated: 0 B │ estimated row count: 1 (100% of the table; stats collected ago) │ table: c@sec @@ -192,12 +196,13 @@ regions: KV contention time: 0µs KV rows read: 2 KV bytes read: 16 B + KV gRPC calls: 2 estimated max memory allocated: 0 B missing stats table: d@d_pkey spans: FULL SCAN · -Diagram: https://cockroachdb.github.io/distsqlplan/decode.html#eJzkUsFq20wQvv9PMcwpIfvHkhx6WAiYGrc4re1ih1yKKevdqSMs7Sq7I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eoIMaUmyeerZvrHbnr_XEKiqQZX-DhovCvoLW2WHbLUZnmx7NTVQn-s7etjMz-J_fjac7r_o9C-DG2OdIkdqy9x5q_wd5ZnvmpAr6MKWhlyvv_1dmr6Eo0F6cnzuyuI2HpHhrF1hkP5rIT07JKQ5-doaT7sWPntz0vpGqqD4D942TtKls7J7JpazTtcBinyI3TQWYxNb7YCb4nSvuL8lTnfF2QHibFfc3ys-2xl7vn71IwAA___k6iBM statement ok RESET vectorize; RESET distsql diff --git a/pkg/sql/opt/exec/explain/emit.go b/pkg/sql/opt/exec/explain/emit.go index 307f65655e64..0cc097585369 100644 --- a/pkg/sql/opt/exec/explain/emit.go +++ b/pkg/sql/opt/exec/explain/emit.go @@ -392,6 +392,9 @@ func (e *emitter) emitNodeAttributes(n *Node) error { if s.KVBytesRead.HasValue() { e.ob.AddField("KV bytes read", humanize.IBytes(s.KVBytesRead.Value())) } + if s.KVBatchRequestsIssued.HasValue() { + e.ob.AddField("KV gRPC calls", string(humanizeutil.Count(s.KVBatchRequestsIssued.Value()))) + } if s.MaxAllocatedMem.HasValue() { e.ob.AddField("estimated max memory allocated", humanize.IBytes(s.MaxAllocatedMem.Value())) } diff --git a/pkg/sql/opt/exec/explain/output.go b/pkg/sql/opt/exec/explain/output.go index 96291227aa7f..d565ea5c6c66 100644 --- a/pkg/sql/opt/exec/explain/output.go +++ b/pkg/sql/opt/exec/explain/output.go @@ -363,10 +363,12 @@ func (ob *OutputBuilder) AddExecutionTime(delta time.Duration) { ob.AddTopLevelField("execution time", string(humanizeutil.Duration(delta))) } -// AddKVReadStats adds a top-level field for the bytes/rows read from KV. -func (ob *OutputBuilder) AddKVReadStats(rows, bytes int64) { +// AddKVReadStats adds a top-level field for the bytes/rows read from KV as well +// as for the number of BatchRequests issued. +func (ob *OutputBuilder) AddKVReadStats(rows, bytes, batchRequests int64) { ob.AddTopLevelField("rows read from KV", fmt.Sprintf( - "%s (%s)", humanizeutil.Count(uint64(rows)), humanizeutil.IBytes(bytes), + "%s (%s, %s gRPC calls)", humanizeutil.Count(uint64(rows)), + humanizeutil.IBytes(bytes), humanizeutil.Count(uint64(batchRequests)), )) } diff --git a/pkg/sql/opt/exec/factory.go b/pkg/sql/opt/exec/factory.go index 5d72b4196e43..db1a91ebc0ff 100644 --- a/pkg/sql/opt/exec/factory.go +++ b/pkg/sql/opt/exec/factory.go @@ -324,10 +324,11 @@ type ExecutionStats struct { // operator. VectorizedBatchCount optional.Uint - KVTime optional.Duration - KVContentionTime optional.Duration - KVBytesRead optional.Uint - KVRowsRead optional.Uint + KVTime optional.Duration + KVContentionTime optional.Duration + KVBytesRead optional.Uint + KVRowsRead optional.Uint + KVBatchRequestsIssued optional.Uint StepCount optional.Uint InternalStepCount optional.Uint diff --git a/pkg/sql/row/fetcher.go b/pkg/sql/row/fetcher.go index 49ad36d0166a..7f1e4ae3e3dd 100644 --- a/pkg/sql/row/fetcher.go +++ b/pkg/sql/row/fetcher.go @@ -376,12 +376,13 @@ func (rf *Fetcher) Init(ctx context.Context, args FetcherInitArgs) error { acc: rf.kvFetcherMemAcc, forceProductionKVBatchSize: args.ForceProductionKVBatchSize, } + var batchRequestsIssued int64 if args.Txn != nil { - fetcherArgs.sendFn = makeKVBatchFetcherDefaultSendFunc(args.Txn) + fetcherArgs.sendFn = makeKVBatchFetcherDefaultSendFunc(args.Txn, &batchRequestsIssued) fetcherArgs.requestAdmissionHeader = args.Txn.AdmissionHeader() fetcherArgs.responseAdmissionQ = args.Txn.DB().SQLKVResponseAdmissionQ } - rf.kvFetcher = newKVFetcher(newKVBatchFetcher(fetcherArgs)) + rf.kvFetcher = newKVFetcher(newKVBatchFetcher(fetcherArgs), &batchRequestsIssued) } return nil @@ -397,7 +398,8 @@ func (rf *Fetcher) Init(ctx context.Context, args FetcherInitArgs) error { // the caller should be careful since reads performed under different txns // do not provide consistent view of the data. func (rf *Fetcher) SetTxn(txn *kv.Txn) error { - return rf.setTxnAndSendFn(txn, makeKVBatchFetcherDefaultSendFunc(txn)) + sendFn := makeKVBatchFetcherDefaultSendFunc(txn, rf.kvFetcher.atomics.batchRequestsIssued) + return rf.setTxnAndSendFn(txn, sendFn) } // setTxnAndSendFn peeks inside of the KVFetcher to update the underlying @@ -596,10 +598,15 @@ func (rf *Fetcher) StartScanFrom(ctx context.Context, f KVBatchFetcher) error { if !rf.args.WillUseCustomKVBatchFetcher { return errors.AssertionFailedf("StartScanFrom is called instead of StartScan") } + var batchRequestsIssued *int64 if rf.kvFetcher != nil { rf.kvFetcher.Close(ctx) + // Keep the same counter across different fetchers. + batchRequestsIssued = rf.kvFetcher.atomics.batchRequestsIssued + } else { + batchRequestsIssued = new(int64) } - rf.kvFetcher = newKVFetcher(f) + rf.kvFetcher = newKVFetcher(f, batchRequestsIssued) return rf.startScan(ctx) } @@ -1237,3 +1244,9 @@ func (rf *Fetcher) Key() roachpb.Key { func (rf *Fetcher) GetBytesRead() int64 { return rf.kvFetcher.GetBytesRead() } + +// GetBatchRequestsIssued returns total number of BatchRequests issued by the +// underlying KVFetcher. +func (rf *Fetcher) GetBatchRequestsIssued() int64 { + return rf.kvFetcher.GetBatchRequestsIssued() +} diff --git a/pkg/sql/row/kv_batch_fetcher.go b/pkg/sql/row/kv_batch_fetcher.go index da161806f8f7..50312f026a5c 100644 --- a/pkg/sql/row/kv_batch_fetcher.go +++ b/pkg/sql/row/kv_batch_fetcher.go @@ -225,7 +225,7 @@ func (f *txnKVFetcher) getBatchKeyLimitForIdx(batchIdx int) rowinfra.KeyLimit { } } -func makeKVBatchFetcherDefaultSendFunc(txn *kv.Txn) sendFunc { +func makeKVBatchFetcherDefaultSendFunc(txn *kv.Txn, batchRequestsIssued *int64) sendFunc { return func( ctx context.Context, ba roachpb.BatchRequest, @@ -234,6 +234,7 @@ func makeKVBatchFetcherDefaultSendFunc(txn *kv.Txn) sendFunc { if err != nil { return nil, err.GoError() } + *batchRequestsIssued++ return res, nil } } diff --git a/pkg/sql/row/kv_fetcher.go b/pkg/sql/row/kv_fetcher.go index 115c409d77a2..33a2cf1b4433 100644 --- a/pkg/sql/row/kv_fetcher.go +++ b/pkg/sql/row/kv_fetcher.go @@ -43,7 +43,8 @@ type KVFetcher struct { // Observability fields. // Note: these need to be read via an atomic op. atomics struct { - bytesRead int64 + bytesRead int64 + batchRequestsIssued *int64 } } @@ -73,9 +74,10 @@ func NewKVFetcher( forceProductionKVBatchSize bool, ) *KVFetcher { var sendFn sendFunc + var batchRequestsIssued int64 // Avoid the heap allocation by allocating sendFn specifically in the if. if bsHeader == nil { - sendFn = makeKVBatchFetcherDefaultSendFunc(txn) + sendFn = makeKVBatchFetcherDefaultSendFunc(txn, &batchRequestsIssued) } else { negotiated := false sendFn = func(ctx context.Context, ba roachpb.BatchRequest) (br *roachpb.BatchResponse, _ error) { @@ -94,6 +96,7 @@ func NewKVFetcher( if pErr != nil { return nil, pErr.GoError() } + batchRequestsIssued++ return br, nil } } @@ -114,7 +117,7 @@ func NewKVFetcher( fetcherArgs.requestAdmissionHeader = txn.AdmissionHeader() fetcherArgs.responseAdmissionQ = txn.DB().SQLKVResponseAdmissionQ } - return newKVFetcher(newKVBatchFetcher(fetcherArgs)) + return newKVFetcher(newKVBatchFetcher(fetcherArgs), &batchRequestsIssued) } // NewStreamingKVFetcher returns a new KVFetcher that utilizes the provided @@ -136,6 +139,7 @@ func NewStreamingKVFetcher( diskBuffer kvstreamer.ResultDiskBuffer, kvFetcherMemAcc *mon.BoundAccount, ) *KVFetcher { + var batchRequestsIssued int64 streamer := kvstreamer.NewStreamer( distSender, stopper, @@ -144,6 +148,7 @@ func NewStreamingKVFetcher( getWaitPolicy(lockWaitPolicy), streamerBudgetLimit, streamerBudgetAcc, + &batchRequestsIssued, ) mode := kvstreamer.OutOfOrder if maintainOrdering { @@ -158,13 +163,15 @@ func NewStreamingKVFetcher( maxKeysPerRow, diskBuffer, ) - return newKVFetcher(newTxnKVStreamer(streamer, lockStrength, kvFetcherMemAcc)) + return newKVFetcher(newTxnKVStreamer(streamer, lockStrength, kvFetcherMemAcc), &batchRequestsIssued) } -func newKVFetcher(batchFetcher KVBatchFetcher) *KVFetcher { - return &KVFetcher{ +func newKVFetcher(batchFetcher KVBatchFetcher, batchRequestsIssued *int64) *KVFetcher { + f := &KVFetcher{ KVBatchFetcher: batchFetcher, } + f.atomics.batchRequestsIssued = batchRequestsIssued + return f } // GetBytesRead returns the number of bytes read by this fetcher. It is safe for @@ -176,6 +183,16 @@ func (f *KVFetcher) GetBytesRead() int64 { return atomic.LoadInt64(&f.atomics.bytesRead) } +// GetBatchRequestsIssued returns the number of BatchRequests issued by this +// fetcher throughout its lifetime. It is safe for concurrent use and is able to +// handle a case of uninitialized fetcher. +func (f *KVFetcher) GetBatchRequestsIssued() int64 { + if f == nil { + return 0 + } + return atomic.LoadInt64(f.atomics.batchRequestsIssued) +} + // MVCCDecodingStrategy controls if and how the fetcher should decode MVCC // timestamps from returned KV's. type MVCCDecodingStrategy int diff --git a/pkg/sql/rowexec/inverted_joiner.go b/pkg/sql/rowexec/inverted_joiner.go index c3f738065d29..2dc24f211e7b 100644 --- a/pkg/sql/rowexec/inverted_joiner.go +++ b/pkg/sql/rowexec/inverted_joiner.go @@ -766,10 +766,11 @@ func (ij *invertedJoiner) execStatsForTrace() *execinfrapb.ComponentStats { ret := execinfrapb.ComponentStats{ Inputs: []execinfrapb.InputStats{is}, KV: execinfrapb.KVStats{ - BytesRead: optional.MakeUint(uint64(ij.fetcher.GetBytesRead())), - TuplesRead: fis.NumTuples, - KVTime: fis.WaitTime, - ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(ij.Ctx, ij.ExecStatsTrace)), + BytesRead: optional.MakeUint(uint64(ij.fetcher.GetBytesRead())), + TuplesRead: fis.NumTuples, + KVTime: fis.WaitTime, + ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(ij.Ctx, ij.ExecStatsTrace)), + BatchRequestsIssued: optional.MakeUint(uint64(ij.fetcher.GetBatchRequestsIssued())), }, Exec: execinfrapb.ExecStats{ MaxAllocatedMem: optional.MakeUint(uint64(ij.MemMonitor.MaximumBytes())), diff --git a/pkg/sql/rowexec/joinreader.go b/pkg/sql/rowexec/joinreader.go index 4d88690ac0bc..26a5aa36924c 100644 --- a/pkg/sql/rowexec/joinreader.go +++ b/pkg/sql/rowexec/joinreader.go @@ -1128,10 +1128,11 @@ func (jr *joinReader) execStatsForTrace() *execinfrapb.ComponentStats { ret := &execinfrapb.ComponentStats{ Inputs: []execinfrapb.InputStats{is}, KV: execinfrapb.KVStats{ - BytesRead: optional.MakeUint(uint64(jr.fetcher.GetBytesRead())), - TuplesRead: fis.NumTuples, - KVTime: fis.WaitTime, - ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(jr.Ctx, jr.ExecStatsTrace)), + BytesRead: optional.MakeUint(uint64(jr.fetcher.GetBytesRead())), + TuplesRead: fis.NumTuples, + KVTime: fis.WaitTime, + ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(jr.Ctx, jr.ExecStatsTrace)), + BatchRequestsIssued: optional.MakeUint(uint64(jr.fetcher.GetBatchRequestsIssued())), }, Output: jr.OutputHelper.Stats(), } diff --git a/pkg/sql/rowexec/rowfetcher.go b/pkg/sql/rowexec/rowfetcher.go index de123a4c6ec7..481d73da92c9 100644 --- a/pkg/sql/rowexec/rowfetcher.go +++ b/pkg/sql/rowexec/rowfetcher.go @@ -50,6 +50,7 @@ type rowFetcher interface { Reset() GetBytesRead() int64 + GetBatchRequestsIssued() int64 // Close releases any resources held by this fetcher. Close(ctx context.Context) } diff --git a/pkg/sql/rowexec/stats.go b/pkg/sql/rowexec/stats.go index 1c7f361873d7..df7a0ecf789d 100644 --- a/pkg/sql/rowexec/stats.go +++ b/pkg/sql/rowexec/stats.go @@ -165,6 +165,11 @@ func (c *rowFetcherStatCollector) GetBytesRead() int64 { return c.fetcher.GetBytesRead() } +// GetBatchRequestsIssued is part of the rowFetcher interface. +func (c *rowFetcherStatCollector) GetBatchRequestsIssued() int64 { + return c.fetcher.GetBatchRequestsIssued() +} + // Close is part of the rowFetcher interface. func (c *rowFetcherStatCollector) Close(ctx context.Context) { c.fetcher.Close(ctx) diff --git a/pkg/sql/rowexec/tablereader.go b/pkg/sql/rowexec/tablereader.go index 0d0dcd253879..2ea71b40f80b 100644 --- a/pkg/sql/rowexec/tablereader.go +++ b/pkg/sql/rowexec/tablereader.go @@ -309,10 +309,11 @@ func (tr *tableReader) execStatsForTrace() *execinfrapb.ComponentStats { tr.scanStats = execstats.GetScanStats(tr.Ctx, tr.ExecStatsTrace) ret := &execinfrapb.ComponentStats{ KV: execinfrapb.KVStats{ - BytesRead: optional.MakeUint(uint64(tr.fetcher.GetBytesRead())), - TuplesRead: is.NumTuples, - KVTime: is.WaitTime, - ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(tr.Ctx, tr.ExecStatsTrace)), + BytesRead: optional.MakeUint(uint64(tr.fetcher.GetBytesRead())), + TuplesRead: is.NumTuples, + KVTime: is.WaitTime, + ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(tr.Ctx, tr.ExecStatsTrace)), + BatchRequestsIssued: optional.MakeUint(uint64(tr.fetcher.GetBatchRequestsIssued())), }, Output: tr.OutputHelper.Stats(), } diff --git a/pkg/sql/rowexec/zigzagjoiner.go b/pkg/sql/rowexec/zigzagjoiner.go index 1dc396461a6f..38fb1681c08e 100644 --- a/pkg/sql/rowexec/zigzagjoiner.go +++ b/pkg/sql/rowexec/zigzagjoiner.go @@ -840,8 +840,9 @@ func (z *zigzagJoiner) execStatsForTrace() *execinfrapb.ComponentStats { z.scanStats = execstats.GetScanStats(z.Ctx, z.ExecStatsTrace) kvStats := execinfrapb.KVStats{ - BytesRead: optional.MakeUint(uint64(z.getBytesRead())), - ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(z.Ctx, z.ExecStatsTrace)), + BytesRead: optional.MakeUint(uint64(z.getBytesRead())), + ContentionTime: optional.MakeTimeValue(execstats.GetCumulativeContentionTime(z.Ctx, z.ExecStatsTrace)), + BatchRequestsIssued: optional.MakeUint(uint64(z.getBatchRequestsIssued())), } execstats.PopulateKVMVCCStats(&kvStats, &z.scanStats) for i := range z.infos { @@ -874,6 +875,14 @@ func (z *zigzagJoiner) getRowsRead() int64 { return rowsRead } +func (z *zigzagJoiner) getBatchRequestsIssued() int64 { + var batchRequestsIssued int64 + for i := range z.infos { + batchRequestsIssued += z.infos[i].fetcher.GetBatchRequestsIssued() + } + return batchRequestsIssued +} + func (z *zigzagJoiner) generateMeta() []execinfrapb.ProducerMetadata { trailingMeta := make([]execinfrapb.ProducerMetadata, 1, 2) meta := &trailingMeta[0]