I Know how to get Number Of Rows in a table in MySQL 5 version and later.
MySQL 5
select table_rows from tables where table_name = 'tableName';
I want to know how to get this in MySQL 4 because count(*) query takes to 4 to 5 minutes in large tables.
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.
SELECT COUNT(*)tells the database engine to still iterate over the individual fields or each record. Since you only care about the raw number of rows, you can try @dj2’s suggestion and doBut I wonder if you get any better performance by counting on the primary key by querying over your clustered index.