[PHP] avoiding time out ..

Status
Not open for further replies.

alaa_ecv_tc

In Runtime
Messages
147
Location
Syria
Hi ..

While testing some codes in PHP and MySQL I had this :

There are 1 million posts where 'prefix' clumon for them all is set to 'add' .
total size of db is about 32Mb .
the runned code is :
SELECT * FROM 'posts' WHERE deleter_id = '0' AND prefix = 'add' ORDER BY id DESC LIMIT 25 OFFSET 900000 ;

In Phpmyadmin it took about 60.6 sec to show results ..

In my program I got that max time for operation is 20 secounds .. and died !!

How can I avoide that limit like phpmyadmin did ?


Thanks :)
 
Instead of increasing the timeout limit it would be better to figure out why your query is taking over a minute to execute in the first place. No query should take that long to display 25 rows of information from only one table. It sounds like a case of improper index use.
 
yes it was .. and I fixed it and it is taking 6 sec ..
But I have more than 60,000 rows to insert/modify into db and make sure not to put the same row again and not deleting old data .. the only unique part of data is the work order number and it is 12 digits .. so it is really taking too long to process data on the 32bit server they have :)
 
Download the database, setup on your pc use the php.ini to increase the maximum execution time. Make the required changes to the database. Upload the modified the database again.
 
Status
Not open for further replies.
Back
Top Bottom