| 1288 | } |
| 1289 | |
| 1290 | func pickupPossibleField(tctx *tcontext.Context, meta TableMeta, db *BaseConn) (string, error) { |
| 1291 | // try using _tidb_rowid first |
| 1292 | if meta.HasImplicitRowID() { |
| 1293 | return "_tidb_rowid", nil |
| 1294 | } |
| 1295 | // try to use pk or uk |
| 1296 | fieldName, err := getNumericIndex(tctx, db, meta) |
| 1297 | if err != nil { |
| 1298 | return "", err |
| 1299 | } |
| 1300 | |
| 1301 | // if fieldName == "", there is no proper index |
| 1302 | return fieldName, nil |
| 1303 | } |
| 1304 | |
| 1305 | func estimateCount(tctx *tcontext.Context, dbName, tableName string, db *BaseConn, field string, conf *Config) uint64 { |
| 1306 | var query string |