input
02-14-2006, 04:01 AM
Hi folks,
I'm a very proficient PHP programmer that has always stayed away from the OOP side of things, but have always known that sooner or later I'll have to delve into OO PHP.
I've written large PHP projects before w/o using OOP, and I've found maintaining the script to be a nightmare, and I'm pretty sure that if I'd used classes, it would be easier - am I right on that?
Anyway, I'm starting a new large project and already I've hit a crippler. The project is very reliant on MySQL with the databases it will uses running to many 100s thousands rows long in total (single tables run to about 50k rows max).
To start out there is only one table with 38k entries and this is where I've hit a very big problem - All the table rows need to be verified and updated at least once a week with data held in flatfiles. About 1-5% of all rows will be updated. However, even without any updates, just a simple recursive SELECT on all the lines of the flatfile (each line represents a row in a db table) for ONE table takes 50 minutes or so to run (each SELECT is taking about 0.05 or 0.1 seconds to run in the foreach() PHP loop).
So, as the sql commands are not too taxing w/r to memory, I would like the script to spawn a few 1000 queries a time (mysql is set to handle 100k concurrent connections), which should speed the script up quite a lot.
Isn't this what OO PHP can do - spawn objects/classes or something?
If in the foreach() loop I can spawn a fresh SELECT query routine without holding up the script waiting for the sql query to finish, how can I limit the number of queries spawned?
I would very much appreciate any insight!
Cheers
Andy
I'm a very proficient PHP programmer that has always stayed away from the OOP side of things, but have always known that sooner or later I'll have to delve into OO PHP.
I've written large PHP projects before w/o using OOP, and I've found maintaining the script to be a nightmare, and I'm pretty sure that if I'd used classes, it would be easier - am I right on that?
Anyway, I'm starting a new large project and already I've hit a crippler. The project is very reliant on MySQL with the databases it will uses running to many 100s thousands rows long in total (single tables run to about 50k rows max).
To start out there is only one table with 38k entries and this is where I've hit a very big problem - All the table rows need to be verified and updated at least once a week with data held in flatfiles. About 1-5% of all rows will be updated. However, even without any updates, just a simple recursive SELECT on all the lines of the flatfile (each line represents a row in a db table) for ONE table takes 50 minutes or so to run (each SELECT is taking about 0.05 or 0.1 seconds to run in the foreach() PHP loop).
So, as the sql commands are not too taxing w/r to memory, I would like the script to spawn a few 1000 queries a time (mysql is set to handle 100k concurrent connections), which should speed the script up quite a lot.
Isn't this what OO PHP can do - spawn objects/classes or something?
If in the foreach() loop I can spawn a fresh SELECT query routine without holding up the script waiting for the sql query to finish, how can I limit the number of queries spawned?
I would very much appreciate any insight!
Cheers
Andy
