Skip to content

Commit 30b8f42

Browse files
committed
PMM-9288 Remove nScanned completely.
1 parent 330ca87 commit 30b8f42

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/go/mongolib/stats/stats.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ func (g GroupKey) String() string {
270270

271271
type totalCounters struct {
272272
Count int
273-
Scanned float64
274273
Returned float64
275274
QueryTime float64
276275
Bytes float64
@@ -298,7 +297,6 @@ type QueryStats struct {
298297
ResponseLengthCount int
299298
ResponseLength Statistics
300299
Returned Statistics
301-
Scanned Statistics
302300

303301
PlanSummary string
304302
CollScanCount int
@@ -376,9 +374,6 @@ func countersToStats(query QueryInfoAndCounters, uptime int64, tc totalCounters)
376374
StorageTimeReadingMicrosCount: len(query.StorageTimeReadingMicros),
377375
StorageTimeReadingMicros: calcStats(query.StorageTimeReadingMicros),
378376
}
379-
if tc.Scanned > 0 {
380-
queryStats.Scanned.Pct = queryStats.Scanned.Total * 100 / tc.Scanned
381-
}
382377
if tc.Returned > 0 {
383378
queryStats.Returned.Pct = queryStats.Returned.Total * 100 / tc.Returned
384379
}
@@ -388,9 +383,6 @@ func countersToStats(query QueryInfoAndCounters, uptime int64, tc totalCounters)
388383
if tc.Bytes > 0 {
389384
queryStats.ResponseLength.Pct = queryStats.ResponseLength.Total * 100 / tc.Bytes
390385
}
391-
if queryStats.Returned.Total > 0 {
392-
queryStats.Ratio = queryStats.Scanned.Total / queryStats.Returned.Total
393-
}
394386
if tc.DocsExamined > 0 {
395387
queryStats.DocsExamined.Pct = queryStats.DocsExamined.Total * 100 / tc.DocsExamined
396388
}
@@ -460,6 +452,10 @@ func calcTotalCounters(queries []QueryInfoAndCounters) totalCounters {
460452
}
461453

462454
func calcStats(samples []float64) Statistics {
455+
if len(samples) == 0 {
456+
return Statistics{}
457+
}
458+
463459
var s Statistics
464460
s.Total, _ = stats.Sum(samples)
465461
s.Min, _ = stats.Min(samples)

src/go/pt-mongodb-query-digest/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,23 +497,23 @@ func sortQueries(queries []stats.QueryStats, orderby []string) []stats.QueryStat
497497
}
498498

499499
//
500-
case "docs-scanned":
500+
case "docs-examined":
501501
f = func(c1, c2 *stats.QueryStats) bool {
502-
return c1.Scanned.Max < c2.Scanned.Max
502+
return c1.DocsExamined.Max < c2.DocsExamined.Max
503503
}
504-
case "-docs-scanned":
504+
case "-docs-examined":
505505
f = func(c1, c2 *stats.QueryStats) bool {
506-
return c1.Scanned.Max > c2.Scanned.Max
506+
return c1.DocsExamined.Max > c2.DocsExamined.Max
507507
}
508508

509509
//
510510
case "docs-returned":
511511
f = func(c1, c2 *stats.QueryStats) bool {
512-
return c1.Returned.Max < c2.Scanned.Max
512+
return c1.Returned.Max < c2.DocsExamined.Max
513513
}
514514
case "-docs-returned":
515515
f = func(c1, c2 *stats.QueryStats) bool {
516-
return c1.Returned.Max > c2.Scanned.Max
516+
return c1.Returned.Max > c2.DocsExamined.Max
517517
}
518518
}
519519
// count,query-time,docs-scanned, docs-returned. - in front of the field name denotes reverse order.")

0 commit comments

Comments
 (0)