Navigation Menu

Skip to content

Commit

Permalink
explains the order in which records are fetched by find_each
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Mar 13, 2009
1 parent 8ac0e63 commit 6064446
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion railties/guides/source/active_record_querying.textile
Expand Up @@ -809,7 +809,7 @@ To be able to iterate over big sets of rows like that Active Record provides +fi

Behind the scenes +find_each+ fetches rows in batches of 1000 and yields them one by one. The size of the underlying batches is configurable via the +:batch_size+ option.

The +:start+ option allows you to configure the first ID of the sequence if the lowest is not the one you need. This may be useful for example to be able to resume an interrupted batch process if it saves the last processed ID as a checkpoint.
Records are fetched in ascending order on the primary key, which must be an integer. The +:start+ option allows you to configure the first ID of the sequence if the lowest is not the one you need. This may be useful for example to be able to resume an interrupted batch process if it saves the last processed ID as a checkpoint.

+find_each+ accepts the same options as +find+ except for +:order+ and +:limit+. Those two are needed internally and if the options argument include any of them an exception is raised.

Expand Down

0 comments on commit 6064446

Please sign in to comment.