Optimize MySQL database query
Posted
by
rajeeesh
on Stack Overflow
See other posts from Stack Overflow
or by rajeeesh
Published on 2012-03-28T05:17:12Z
Indexed on
2012/03/28
5:30 UTC
Read the original article
Hit count: 139
mysql
|mysql-management
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
© Stack Overflow or respective owner