note 114360 deleted from function.fputcsv by googleguy

From: Date: Wed, 12 Feb 2014 19:07:48 +0000
Subject: note 114360 deleted from function.fputcsv by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198478@lists.php.net to get a copy of this message
Note Submitter: mishadar at gmail dot com ---- Optimization & Performance notes. fputcsv as a solution may fit small chunk of data. What if you have query resulting in 10k rows? Looping it 10K iterations to create respected csv file is heavily both time & resource consuming. My rule of thumb for Max-Loop size in WEB code is around 1K iterations. Anything beyond it, should performed either at background (ajax call for instance), or as cron, or... other solution that available to bypass a loop. MySQL engine has a function writing query results in CSV format directly to disk. Bottom line - whenever it possible spare big loop processing time by moving whatever processed in loop toward DB engine. Eventually it will pleasantly impact your WEB page loading time.

« previous php.notes (#198478) next »