I have a main table with 80lacs record (say TABLE : MAIN_TABLE) I want to fire many queries in which i need to find all records matching approx 10 criteria that are register in 6 months(11 lacs)
I have created a composite index on 2 column (col1 , col2) , however still queries is talking time in executing approx 30-50 seconds.
there are approx 12 index on this table and approx 60columns. when i use explain , it shows 5102 rows will be examined and its using index.
Solution I use : i decide to create a trigger which will insert into this a new table(MAIN_TABLE_ACTIVE) with only one index and last 6 months records and limited columns(12) when i fire query on this tables results are coming in order of 2-6 seconds.
Question : is this best approach as i use table of 11lacs instead of 80lacs ?
Drawbacks : overhead for triggeer :-(
suggest any new approach or please comment on my approach of this problem.