Re: Bug #3235: wasting many time in indexing operations in large loop
| From: | Mark Musone | Date: | Mon, 18 Jan 0100 17:13:04 +0000 |
| Subject: | Re: Bug #3235: wasting many time in indexing operations in large loop | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-14717@lists.php.net to get a copy of this message | ||
Check the mysql manual on "select into outfile" ..
Mark
>
> From: libes@com.univ-mrs.fr
> Operating system: linux redhat 6.0
> PHP version: 3.0.12
> PHP Bug Type: Performance problem
> Bug description: wasting many time in indexing operations in large loop
>
> hi to all and many thanks if you can tell me something...
>
> we dump a little mysql database (90000 records) via php3-mysql
> we write the records in an ascii file in order to get it via ftp
> in a html frontend page we can select some buttons before the sql
> query is launched.. these buttons are recuperated in the php code in a little loop where we
> compose the name of the variables...
>
> our problem is that we waste many many time (45sec) inside the main loop
> (while $row) just to make the result line
>
> /* $bouton=strtok($liste," ");
> while($bouton) {
> $ligne=$ligne.$row["$bouton"]."\t";
> $bouton = strtok(" ");
> }
> */
> if we comment these lines (and we hardcode the composition of the result line) above we gain
> half the total time
>
> am i clear?
> thanks if you have a solution? or maybe we touch the limit of the system?
> ML
>
> --------- to make a list of selected buttons---------
> $liste="";
> for ($k=1; $k<21; $k++)
> {
> $s="b".$k;
> $long=strlen(${$s});
> if ($long>0) {
> $liste=$liste.${$s}." " ;
> }
> }
> chop($liste);
>
> --------to dump the selected colums--------
> while ($row ) /*# 90000 records*/
> {
> /* $bouton=strtok($liste," ");
> while($bouton) {
> $uneligne=$uneligne.$row["$bouton"]."\t";
> $bouton = strtok(" ");
> }
> */
>
> /* we gain many time if the above lines are comented ... why?*/
> $uneligne=$row["Latitude"] ." ". $row["Longitude"]
> ." ". $row["Date"] ." ". $row["ProfMes"] ."
> ". $row["Temp"] ." ". $row["Cond"] ." ".
> $row["TempPot"] ." ". $row["Sal"] ." ".
> $row["Sig0"] ." ". $row["Sig2"] ." ".
> $row["Tur"] ." ". $row["Fluo"] ." ".
> $row["O2d"]
> . "\n" ;
> $uneligne=$uneligne."\n";
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>