Skip to content

Commit 7f4380b

Browse files
jycorJames Cor
andauthored
don't make string unless in debug (#3293)
Co-authored-by: James Cor <james@ucsd.edu>
1 parent 82d3860 commit 7f4380b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

server/handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,10 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
702702
defer wg.Done()
703703
for {
704704
if r == nil {
705-
r = &sqltypes.Result{Fields: resultFields}
705+
r = &sqltypes.Result{
706+
Fields: resultFields,
707+
Rows: make([][]sqltypes.Value, 0, rowsBatch),
708+
}
706709
}
707710
if r.RowsAffected == rowsBatch {
708711
if err := resetCallback(r, more); err != nil {

sql/analyzer/costed_index_scan.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ func costedIndexLookup(ctx *sql.Context, n sql.Node, a *Analyzer, iat sql.IndexA
141141
ret = plan.NewTableAlias(aliasName, ret)
142142
}
143143

144-
a.Log("new indexed table: %s/%s/%s", ita.Index().Database(), ita.Index().Table(), ita.Index().ID())
145-
a.Log("index stats cnt: %d", stats.RowCount())
146-
a.Log("index stats histogram: %s", stats.Histogram().DebugString())
144+
if a.Debug {
145+
a.Log("new indexed table: %s/%s/%s", ita.Index().Database(), ita.Index().Table(), ita.Index().ID())
146+
a.Log("index stats cnt: %d", stats.RowCount())
147+
a.Log("index stats histogram: %s", stats.Histogram().DebugString())
148+
}
147149

148150
// excluded from tree + not included in index scan => filter above scan
149151
if len(filters) > 0 {

0 commit comments

Comments
 (0)