Skip to content

Commit

Permalink
planner: ignore the virtual column when collect statistics (#10623) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lonng authored and winkyao committed May 29, 2019
1 parent 74e32e8 commit a6cb414
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,10 @@ func (b *PlanBuilder) buildCheckIndexSchema(tn *ast.TableName, indexName string)
func getColsInfo(tn *ast.TableName) (indicesInfo []*model.IndexInfo, colsInfo []*model.ColumnInfo, pkCol *model.ColumnInfo) {
tbl := tn.TableInfo
for _, col := range tbl.Columns {
// The virtual column will not store any data in TiKV, so it should be ignored when collect statistics
if col.IsGenerated() && !col.GeneratedStored {
continue
}
if tbl.PKIsHandle && mysql.HasPriKeyFlag(col.Flag) {
pkCol = col
} else {
Expand Down

0 comments on commit a6cb414

Please sign in to comment.