Wednesday, November 24, 2010

Find A Tricky Way To Avoid Slow SQL Query

This afternoon I'm doing a task in my office, querying a massive data from mysql with PHP script. The query string contains four join statements and six expressions in the where clause. The result contain data that necessary for all student transcript. I have try querying it at once, but I think I will never get the result at all since it's never finish loading the process. So, I change my PHP script to loop the query for each student and voila!! The process runs smoothly although take a long time to finish.
Actually, I have no solution for this problem for the massive data query. I just loop the query and it works. Join statement in SQL is really use a high resource. If you have the solution, you can share it by leaving a comment on this post. Thanks! :)

0 comments to “Find A Tricky Way To Avoid Slow SQL Query”

Post a Comment