I’ve been using stored procedures within MySQL and the MySQLi class in PHP for a while now and not had any problems, but am now having some major issues.
I’m reading a number of fairly big XML files (some being 400 MB big) and trying to add each record into my DB.
This is resulting in my stored procedure being called at least once a second… probably more.
To start with I’ve now moved over to using PDO and has speeded things up even more by the looks of it.
I’m just calling the procedure by using the “query” function in the PDO class.
The procedure (I though) was fairly basic, goes like this…
Checks some of the variables passed in have a value, checks to see if a record already exists.
If it does exist, it updates the record, if not, it creates a new record.
Then selects the ID and returns it.
I’m getting about 12,000 record in and then I run out of memory.
Is there any thing I can do either within MySQL or even PHP to prevent this from happening?
Thanks for your time.