Thanks Gevork.. Here is the detail of this database.
I'm building a mortgage program search engine for a lender bank by myself... feel a little scared sometimes(if this program works?)... which is very tough to me. I need to make sure this database could handle the growth in the future.
We sell different type of PROGRAM. Each PROGRAM might have different CONDITION, which i need only one return... the PROGRAM_ID. It doesn't matter i select * or select only PROGRAM_ID, it still slow. Each time of search i need to make sure this PROGRAM return 0 or more than 0 in CONDITION. One PROGRAM normally could have 20-50 CONDITION.... and in each CONDITION i need to verified each field is met.
If every field was met, then the return is > 0, ELSE is 0. I tried to denormalize it at the very beginning... but the number of data growth into 30,000 rows for each CONDITION, which makes me consider to normalize it.
As my query shown, My first is to identify is that the right program to choose.. from PROGRAM_TYPE, is the program a second loan, and is this program being disabled.
THEN i move into CONDITION. I need to met the Loan Amount, Loan To Value, Combined Loan to value, Credit Scored AND is this CONDITION beign disabled.
If every of the CONDITION met, then i move into the third normal form... which is all the sub table under CONDITION...
I have tried to put all sub table under CONDITION into one table.. which we called it here CONDITION DETAIL... and I've tested the speed of select dropped a lot when rows of data goes to 50,000, which is only one or two condition data entered. Then i worried that MySQL might not be able to handle this much data... especially when it goes to 10 million... where every field is need for search.
Here is my plan for today... I'll try to denormalized some sub table under CONDITION, cut down the number of table into 8-10, then create some multi-field indexes...
PLEASE advised me all my friend.. and I could send you my ER-Daigram if you are interested on playing around this database with me.
Waiting to hear from you guys...