What is faster, counting the number of elements in a table or getting the last record?
We are talking about MySql here.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the table is ISAM, row count is cached and should be returned instantly.
If the table is InnoDB, it can be a little slower.
For more information, see especially this comment:
http://www.mysqlperformanceblog.com/2007/04/10/count-vs-countcol/comment-page-1/#comment-106645