Page 1 of 2

[HELP] How to avoid time execution exceeded...

Posted: Tue Jan 30, 2007 7:27 am
by acco
Hi, i got a DB with 10000 records and i've made a script that for each record check if a determinated value is present in other records of the same DB. Each record that match my search is stored in another table.
Te problem is that this script stops cause it reachs the time limit present in php.ini (i've tried to chage that value to 90 secs but the problem persist). The cycle for a single record take some sec, but all that secs for all record cause the timeout.
How can i do to solve this problem????


Thanks




FABIO

Posted: Tue Jan 30, 2007 7:38 am
by Ollie Saunders
10,000 records isn't that much and certainly shouldn't be taking that long. What exactly are you doing with it%AC

I'm not sure but you may be able to disable the max timeout.

Code: Select all

ini_set('max_execution_time', false);

Posted: Tue Jan 30, 2007 8:40 am
by acco
i was thinking that i have to change something in my script, cause the check, and all operations if the check match or not, isn't only on 10.000 records, but for each one of the 10.000 i have to check the value in all other 9.999 records!! So in total the script generate 100.000.000 operations! So is normal that is go in timeout...
Any suggestion is very wellcome!!

Posted: Tue Jan 30, 2007 9:16 am
by feyd
Are you using a database?

Posted: Tue Jan 30, 2007 9:19 am
by acco
feyd wrote:Are you using a database?
Yes all my record are in MYSQL database

Posted: Tue Jan 30, 2007 9:26 am
by feyd
Can you not have the database do the work for you?

Posted: Tue Jan 30, 2007 10:25 am
by acco
feyd wrote:Can you not have the database do the work for you?
Not at all, cause the value that i compare is an address and i have to extract it from mysql than i do a while in all db and with a function a do the comparasion of the address with all other address. So i've thinckin that i've to review all my script....

Posted: Tue Jan 30, 2007 10:55 am
by feyd
It sure sounds like the database could do it for you.

Posted: Tue Jan 30, 2007 11:06 am
by acco
it can not, or i don't know how to do, cause there are not complex function to compare strings.

Posted: Tue Jan 30, 2007 3:45 pm
by feyd
How do you need to compare the strings?

Posted: Tue Jan 30, 2007 4:59 pm
by acco
cause they r manually insered i can have "main avenue, 23" and "main avanue 23" without comma, i can not use a stric comparation, so i used similar_text(), another function, made by me, to check the number present in both strings and link the compartion with other 2 values (the city and zip code) that are insered with a dropdown menu so i can use a stric comparation.

Posted: Tue Jan 30, 2007 5:13 pm
by feyd
You're comparing the records to each other, yes? I'm fairly sure the database can do the searching for you.

Posted: Tue Jan 30, 2007 5:14 pm
by RobertGonzalez
What version of MySQL are you running? This sounds like something that can be handled at the database level.

Posted: Wed Jan 31, 2007 3:49 am
by acco
Im using Mysql 5.0 (but if needed i can upgrade). You say that my task can handled via databse, but i dont' know how... :(

Posted: Wed Jan 31, 2007 3:55 am
by gavin1996
i think that you should create Index On database table