MCPcopy
hub / github.com/pingcap/tidb / pickupPossibleField

Function pickupPossibleField

dumpling/export/sql.go:1290–1303  ·  view source on GitHub ↗
(tctx *tcontext.Context, meta TableMeta, db *BaseConn)

Source from the content-addressed store, hash-verified

1288}
1289
1290func 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
1305func estimateCount(tctx *tcontext.Context, dbName, tableName string, db *BaseConn, field string, conf *Config) uint64 {
1306 var query string

Callers 3

TestPickupPossibleFieldFunction · 0.85
dumpTableDataMethod · 0.85
concurrentDumpTableMethod · 0.85

Calls 2

getNumericIndexFunction · 0.85
HasImplicitRowIDMethod · 0.65

Tested by 1

TestPickupPossibleFieldFunction · 0.68