code: func (h *Handle) tableStatsFromStorage(tableInfo *model.TableInfo, physicalID int64, loadAll bool) (*statistics.Table, error) {
  	table, ok := h.StatsCache.Load().(StatsCache)[physicalID]
  	// If table stats is pseudo, we also need to copy it, since we will use the column stats when
  	// the average error rate of it is small.
  	if !ok {
  		histColl := statistics.HistColl{
  			PhysicalID:     physicalID,
  			HavePhysicalID: true,
  			Columns:        make(map[int64]*statistics.Column, len(tableInfo.Columns)),
  			Indices:        make(map[int64]*statistics.Index, len(tableInfo.Indices)),
  		}
  		table = &statistics.Table{
  			HistColl: histColl,
  		}
  	} else {
  		// We copy it before writing to avoid race.
  		table = table.Copy()
  	}
  	table.Pseudo = false
  	selSQL := fmt.Sprintf("select table_id, is_index, hist_id, distinct_count, version, null_count, tot_col_size, stats_ver, flag, correlation from mysql.stats_histograms where table_id = %d", physicalID)
  	rows, _, err := h.restrictedExec.ExecRestrictedSQL(nil, selSQL)
  	if err != nil {
  		return nil, errors.Trace(err)
  	}
  	// Check deleted table.
  	if len(rows) == 0 {
  		return nil, nil
  	}
  	for _, row := range rows {
  		if row.GetInt64(1) > 0 {
  			if err := h.indexStatsFromStorage(row, table, tableInfo); err != nil {
  				return nil, errors.Trace(err)
  			}
  		} else {
  			if err := h.columnStatsFromStorage(row, table, tableInfo, loadAll); err != nil {
  				return nil, errors.Trace(err)
  			}
  		}
  	}
  	return table, nil
  }
docs: // tableStatsFromStorage loads table stats info from storage.