nadeemshafi9 Posted September 12, 2007 Share Posted September 12, 2007 hello guys I have a search engine that has been created by a third party, the engin maches the key word to the title of over 6 GB of small files so there are many. The engine then places teh resultant files names in an array, the engine then narrows the result down by labeling each element in the array with the best match and disguarding the rest up until a cirtain amount of results are left. i think it is also reading the files for key words and i also think it is keeping keywords in the DB relating to files, i havent had a chance to take a long look yet. there is also alot of object orientation PHP framwork around the database tables could this be slowing it down ?. THE PROBLEM is it takes too long about 10 - 15 seconds, most of the calculation if not all is done in PHP rather than in SQL by the prior programmer. if i convert it to SQL based calculations will it result in faster time?, i cant use proceedures as it is Mysql 4. Any ideas from anyone at all, even if ur passing by this site and ur new to php. Thanks guys Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 12, 2007 Share Posted September 12, 2007 http://www.zend.com/downloads Zend Optimizer is a free application that runs the files encoded using Zend Guard and enhances the overall performance of your PHP applications. also flat files are faster then any database. good luck. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 12, 2007 Share Posted September 12, 2007 http://webscripts.softpedia.com/script/Snippets/MySQL-Database-Optimizer-9490.html It is handy for optimizing tables in a MySQL database. Optimization helps prevent corruption and increases the speed on you indexes. never used this but speeds index up. Quote Link to comment Share on other sites More sharing options...
btherl Posted September 12, 2007 Share Posted September 12, 2007 also flat files are faster then any database. BAD ADVICE For this application, SQL is vastly superior to flat files, so the developer got that right. As for what's slowing it down, it's hard to say without profiling. Have you tried apd (a php profiler)? It can be a little messy to setup, but it provides valuable data. Another option is to make your own code to profile various parts of the processing, and find where the time is going. The reason profiling is the place to start is so you don't waste time optimizing things that don't actually take much time. Once you know what is slow, then it's time to look at moving those parts into mysql. Quote Link to comment Share on other sites More sharing options...
kireol Posted September 12, 2007 Share Posted September 12, 2007 mysql with index is fastest for searching for strings through large amounts of data. if no index, it can be slow. moving as much as you can to mysql, will also be faster than php, as php is interpreted. Quote Link to comment Share on other sites More sharing options...
nadeemshafi9 Posted September 12, 2007 Author Share Posted September 12, 2007 thanks everyone, btherl, the developer has timed the overall proceedure but has not timed individual units i think this is where i will start, thanks m8ee, will definatly allow me to pinpoint the problem and is a must as a diagnosis, thanks again i cant belive i didnt consider that, but i think i rushed in to sulution. lol Quote Link to comment Share on other sites More sharing options...
nadeemshafi9 Posted September 12, 2007 Author Share Posted September 12, 2007 mysql with index is fastest for searching for strings through large amounts of data. if no index, it can be slow. moving as much as you can to mysql, will also be faster than php, as php is interpreted. 2rue 2rue, tell me more about this indexing ? i have come accross it before. Quote Link to comment Share on other sites More sharing options...
kireol Posted September 12, 2007 Share Posted September 12, 2007 instead of retyping what an index is and how to use it, i googled it for you http://www.databasejournal.com/features/mysql/article.php/1382791 Quote Link to comment Share on other sites More sharing options...
nadeemshafi9 Posted September 12, 2007 Author Share Posted September 12, 2007 indexing looks like the solution after optemising the offending code after locating it by timing events, gr8 info guys i realy appreciate that, thanks Quote Link to comment Share on other sites More sharing options...
kireol Posted September 12, 2007 Share Posted September 12, 2007 optimizing the DB should have been done before he wrote the code, but that doesnt help you Quote Link to comment Share on other sites More sharing options...
Azu Posted September 12, 2007 Share Posted September 12, 2007 http://webscripts.softpedia.com/script/Snippets/MySQL-Database-Optimizer-9490.html It is handy for optimizing tables in a MySQL database. Optimization helps prevent corruption and increases the speed on you indexes. never used this but speeds index up. In what way is this better then the "optimize" function that is built into all versions of MySQL by default? Quote Link to comment Share on other sites More sharing options...
btherl Posted September 12, 2007 Share Posted September 12, 2007 I looked at the script.. it's just a front end to mysql's OPTIMIZE TABLE. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.