Use .only('id') to limit memory usage when iterating over a large number of rows