
10-01-2008, 08:11 PM
|
 |
WebProWorld 1,000+ Club
|
|
Join Date: May 2005
Location: Norway
Posts: 5,612
|
|
Re: I am looking for a PHP algorithm/script
- If there is a unique (simple) formulae, your problem must be related to the magnitude of the problem, billions of IP's in a table column that can easily be transformed to decimal and easily back to dotted notation. Then you have some choices.
- Computation that can be done directly in the database, using SQL calculus (aggregations?) on the table rows / columns.
- Then there is no need for outputting data to a large array and use a PHP script to do the calculus.
- If you have to use a scripting solution, that array may be too big to load it directly into the computers memory.
- If it is too big you may split it into smaller manageable arrays. Once the results are there, the "results arrays" can be combined into a larger array and inserted into the database. May be the best is to use different databases for different countries / rigions with many IP tables and use the unique formula on each.
- Streaming solutions may also be an alternative, where data are read in chunks into the computers memory, transformed and inserted into the result database / tables.
- Personally if it is possible, I would have used 2, since you can do the math directly in the database.
|