Optimize MySQL database query
- by rajeeesh
I had a commenting application in my web site. The comments will store in a MySQL table . table structure as follows
id | Comment | user | created_date
------------------------------------------------------
12 | comment he | 1245 | 2012-03-30 12:15:00
------------------------------------------------------
I need to run a query for listing all the comments after a specific time. ie .. a query like this
SELECT * FROM comments WHERE created_date > "2012-03-29 12:15:00" ORDER BY created_date DESC
Its working fine.. My question is if I got a 1-2 lakh entry in this table is this query is sufficient for the purpose ? or this query will take time to execute ?
In most cases I have to show last 2 days data + periodically ( interval of 10 mins ) checking for updates with ajax from this table ...
Please help
Thanks