Skip to content

Commit

Permalink
Skip reloading the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber committed Apr 9, 2024
1 parent 9a39198 commit c5322f6
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions go/vt/vttablet/tabletserver/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,27 +636,27 @@ func (qre *QueryExecutor) execDDL(conn *StatefulConnection) (*sqltypes.Result, e
}
}

isTemporaryTable := false
if ddlStmt, ok := qre.plan.FullStmt.(sqlparser.DDLStatement); ok {
isTemporaryTable = ddlStmt.IsTemporary()
}
if !isTemporaryTable {
// Temporary tables are limited to the session creating them. There is no need to Reload()
// the table because other connections will not be able to see the table anyway.
defer func() {
// Call se.Reload() with includeStats=false as obtaining table
// size stats involves joining `information_schema.tables`,
// which can be very costly on systems with a large number of
// tables.
//
// Instead of synchronously recalculating table size stats
// after every DDL, let them be outdated until the periodic
// schema reload fixes it.
if err := qre.tsv.se.ReloadAtEx(qre.ctx, mysql.Position{}, false); err != nil {
log.Errorf("failed to reload schema %v", err)
}
}()
}
// isTemporaryTable := false
// if ddlStmt, ok := qre.plan.FullStmt.(sqlparser.DDLStatement); ok {
// isTemporaryTable = ddlStmt.IsTemporary()
// }
// if !isTemporaryTable {
// // Temporary tables are limited to the session creating them. There is no need to Reload()
// // the table because other connections will not be able to see the table anyway.
// // defer func() {
// // // Call se.Reload() with includeStats=false as obtaining table
// // // size stats involves joining `information_schema.tables`,
// // // which can be very costly on systems with a large number of
// // // tables.
// // //
// // // Instead of synchronously recalculating table size stats
// // // after every DDL, let them be outdated until the periodic
// // // schema reload fixes it.
// // if err := qre.tsv.se.ReloadAtEx(qre.ctx, mysql.Position{}, false); err != nil {
// // log.Errorf("failed to reload schema %v", err)
// // }
// // }()
// }
sql := qre.query
// If FullQuery is not nil, then the DDL query was fully parsed
// and we should use the ast to generate the query instead.
Expand Down

0 comments on commit c5322f6

Please sign in to comment.