diff --git a/services/horizon/internal/db2/history/account_loader.go b/services/horizon/internal/db2/history/account_loader.go index 9e15920609..33b1e328b6 100644 --- a/services/horizon/internal/db2/history/account_loader.go +++ b/services/horizon/internal/db2/history/account_loader.go @@ -328,8 +328,9 @@ func bulkGet(ctx context.Context, q *Q, table string, fields []columnValues, res pq.Array(field.objects), ) } + lockSuffix := "ORDER BY id ASC FOR KEY SHARE" sql := `SELECT * FROM ` + table + ` WHERE (` + strings.Join(columns, ",") + `) IN - (SELECT ` + strings.Join(unnestPart, ",") + `)` + (SELECT ` + strings.Join(unnestPart, ",") + `) ` + lockSuffix return q.SelectRaw( ctx,