Alien Posted October 31, 2003 Share Posted October 31, 2003 I\'m curious how people optimize their select statements if they are complex. MySQL 4.0 doesn\'t support nested queries(4.1 supports, but it is an alpha version), so many complex queries have to be broken down with some iterations in php scripts. At the beginning I wrote a nested query and thought that it worked, after I ran it...I remembered that it was not a PostgreSQL DB....so I broke down the query into 3 queries with 2 loops. However, the tables are too big(one has 200,000 rows, another has 20,000 rows, the last one has 6,000 rows), so the process takes about 2 hrs to complete on a LAN. I just want to know, in general, how can I optimize select statements? Quote Link to comment Share on other sites More sharing options...
shivabharat Posted October 31, 2003 Share Posted October 31, 2003 Have a look at this http://mysql.progen.com.tr/doc/en/MySQL_indexes.html http://www.databasejournal.com/features/my...10897_1382791_4 Hope that helps! Quote Link to comment Share on other sites More sharing options...
Alien Posted October 31, 2003 Author Share Posted October 31, 2003 Have a look at this http://mysql.progen.com.tr/doc/en/MySQL_indexes.html http://www.databasejournal.com/features/my...10897_1382791_4 Hope that helps! yea...indexing will help...but for each insert/delete, I have to pay for it since the index tree changes everytime I insert/delete. I am not sure whether it is worth...I will check with my database schema. Thanks. Quote Link to comment Share on other sites More sharing options...
Kriek Posted October 31, 2003 Share Posted October 31, 2003 See -> ADOdb -> Making MySQL Efficient Tutorial Quote Link to comment Share on other sites More sharing options...
Alien Posted November 3, 2003 Author Share Posted November 3, 2003 See -> ADOdb -> Making MySQL Efficient Tutorial briefly scheme through it... looks like a cool lib...will try out soon thanks =) Quote Link to comment Share on other sites More sharing options...
Kriek Posted November 4, 2003 Share Posted November 4, 2003 Alien, no problem, and glad I could be of assistance to you. 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.