cmd/partnerid-to-useragent-migration: LIMIT 1 in MigrateUsers id select query
The select statement is scanning the entire table. Limit to one row. Change-Id: Ie50d9777fb054b197484a83a468d67fa24096bb5
This commit is contained in:
parent
1743a72f21
commit
0d03473e00
@ -24,7 +24,7 @@ func MigrateUsers(ctx context.Context, log *zap.Logger, conn *pgx.Conn, p *Partn
|
||||
more := true
|
||||
|
||||
// select the next ID after startID and offset the result. We will update relevant rows from the range of startID to nextID.
|
||||
_, err = conn.Prepare(ctx, "select-for-update", "SELECT id FROM users WHERE id > $1 ORDER BY id OFFSET $2")
|
||||
_, err = conn.Prepare(ctx, "select-for-update", "SELECT id FROM users WHERE id > $1 ORDER BY id OFFSET $2 LIMIT 1")
|
||||
if err != nil {
|
||||
return errs.New("could not prepare select query")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user