Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6231101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:52:19+00:00 2026-05-24T09:52:19+00:00

After facing a slow loading time issue with a mysql query, I’m now looking

  • 0

After facing a slow loading time issue with a mysql query, I’m now looking the best way to count rows numbers. I have stupidly used mysql_num_rows() function to do this and now realized its a worst way to do this.
I was actually making a Pagination to make pages in PHP.
I have found several ways to count rows number. But I’m looking the faster way to count it.

The table type is MyISAM

So the question is now

Which is the best and faster to count –

1. `SELECT count(*) FROM 'table_name'`

2. `SELECT TABLE_ROWS
FROM INFORMATION_SCHEMA.TABLES WHERE table_schema =  'database_name'
AND table_name LIKE  'table_name'`

3. `SHOW TABLE STATUS LIKE 'table_name'`

4. `SELECT FOUND_ROWS()`

If there are others better way to do this, please let me know them as well.
If possible please describe along with the answer- why it is best and faster. So I could understand and can use the method based on my requirement.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:52:19+00:00Added an answer on May 24, 2026 at 9:52 am

    Quoting the MySQL Reference Manual on COUNT

    COUNT(*) is optimized to return very quickly if the SELECT retrieves
    from one table, no other columns are retrieved, and there is no WHERE
    clause. For example:

    mysql> SELECT COUNT(*) FROM student; 
    

    This optimization applies only to
    MyISAM tables only, because an exact row count is stored for this
    storage engine and can be accessed very quickly. For transactional
    storage engines such as InnoDB, storing an exact row count is more
    problematic because multiple transactions may be occurring, each of
    which may affect the count.

    Also read this question
    MySQL – Complexity of: SELECT COUNT(*) FROM MyTable;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a strange issue after the popup is created onclick . The
After installing the new server, I am facing an issue. I have lot of
We are facing an issue with a SharePoint webpart we have developed. After every
I am facing an issue with oracle db connection after changing java runtime to
I am facing a strange issue where-in my webpage does not load fully after
in my web application i am facing a issue after making it live. i
I am facing a small issue which i am not able after trying so
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file
After lots of attempts and search I have never found a satisfactory way to
Im facing a strange issue trying to move from sql server to oracle. in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.