I make a select over about 1000 records, I create a file and append each record to the file.
1) select 1000 records
2) create file.csv
3) loop query
4) for each record ==> append a line to the file.csv and do some simple calculations
5) output the result of calculation
Sometime the script run and run and never stops. Looking at the file.csv I notice it grows normally, but sometime, the size of the file decrease and then restart growing.
I noticed also that sometime the script stops running, gave the results, but the file.csv continue to grows for tens of minutes ...
If I avoid the building of the file.csv, the script runs really fast and give to me the results almost immediately.
Do you have any clue what the problem could be?