mysql - How to free memory at end of PHP script to make my database insertion script faster for the next request? -
i have php script reads contents of xml file , creates object using
$xml = new simplexmlelement($file_name, 0, true);
it converts object workable array , loops through array , saves data database. i've noticed when using script on , on again, thought xml files same size script takes longer , longer.
do need free memory, or there practices can when i've reached end of memory intensive script?
first thing i'd check database structure. might need drop/add indexes in database tables. stuff slowing down because database slowing down, exposing weak spots in database.
you need metric script. echo out time before , after database queries. check how time spent individually , in total , how on lines containing queries.
so @ beginning , end of script , before , after query lines , do:
echo microtime(), "<br />\n";
if not problem (and surprise me), can check if perhaps storing data (for example) session or so.
Comments
Post a Comment