I want to calculate ratio files, as the ratio of traffic that they generated to their size.
There are hashes and htraff nsize, key — the name of the file, the value of, respectively, traffic, and size. To calculate the ratio, now I use such code:
foreach ($v as $hash=>$size)
So you can choose Top50 most popular files. The code works wildly slowly (the last line), which is not surprising.
How can we change this place more efficient? Is processing inside the base (Ala update files set ratio=traff/size), well, or at least a bulk insert of values. Or for this task, the radish is not suitable?