You will still want to page through the results so that there is not a
huge resultset in memory at once.
$limit = 1000; // some optimal amount of records
$page = 1;
$results = null;
do {
$results = $his->MyModel->findAll($conditions, null, null, $limit,
$page++);
foreach ($results as $row) {
// processing
}
} while (!empty($results);
Something like the above to get pages of results.
HTH,
David Lloyd
--
lloydhome consting, inc.
http://lloydhome.com
On Aug 7, 1:16 am, jheathco <[EMAIL PROTECTED]> wrote:
> The problem is I need to retrieve them all at once because I'm
> processing the returned rows in a cronjob. The pagination would be of
> no use for this feature. Should I just run a manual query instead of
> using the models in this case?
>
> On Aug 6, 9:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > set the limit in the $model->find(); to an acceptable performance
> > level - you can set this dynamically - or look into the pagination
> > component
>
> > On Aug 6, 6:41 pm, jheathco <[EMAIL PROTECTED]> wrote:
>
> > > In PHP, typically prior to cake I had done
>
> > > $res = mysql_query();
> > > while($row = mysql_fetch_array($res))
> > > {
> > > ....
>
> > > }
>
> > > And now in cake, $results = Model->find([query here]) and then loop
> > > thru the results.
>
> > > I am wondering about the limitations if, for instance, a few thousand
> > > rows are returned. In PHP, it seems looping thru each, one at a time,
> > > by calling mysql_fetch_array() was very efficient. However, it seems
> > > like cake may have large performance (and memory) issues by trying to
> > > dump all results into an array before looping thru.
>
> > > Am I correct in this thinking? Is there a way to have cake only
> > > return the results one at a time, rather than buffering them all into
> > > a large array?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---