I have a table having approx 1 crore record.
Required : I need to fire a query which will fetch records from this table having login_date of less than 6 months (yields 5 lacs records) and some conditions , query is talking approx 60sec.
Consideration : if i kept records of login date of last 6 month in a separate table then the query is talking just 1 to 2 seconds.
Solution ?
i should create a separate table by using trigger ?
or any other better solution is better …. like views or something similar ?
Are you using an index on this table? Creating a btree index on login_date should give you about the same performance as having a second table without the schema complexity.
Also, crore and lac aren’t very common English words. Try “ten million” and “five hundred thousand”, and more people should understand what you mean.