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

  • Home
  • SEARCH
  • 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 9068105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:06:34+00:00 2026-06-16T17:06:34+00:00

Looks like count(*) is slower than NUM_ROWS. Can experts in this area throw some

  • 0

Looks like count(*) is slower than NUM_ROWS. Can experts in this area throw some light on this.

  • 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-06-16T17:06:35+00:00Added an answer on June 16, 2026 at 5:06 pm

    According to the documentation NUM_ROWS is the “Number of rows in the table”, so I can see how this might be confusing. There, however, is a major difference between these two methods.

    This query selects the number of rows in MY_TABLE from a system view. This is data that Oracle has previously collected and stored.

    select num_rows from all_tables where table_name = 'MY_TABLE'
    

    This query counts the current number of rows in MY_TABLE

    select count(*) from my_table
    

    By definition they are difference pieces of data. There are two additional pieces of information you need about NUM_ROWS.

    1. In the documentation there’s an asterisk by the column name, which leads to this note:

      Columns marked with an asterisk (*) are populated only if you collect
      statistics on the table with the ANALYZE statement or the DBMS_STATS
      package.

      This means that unless you have gathered statistics on the table then this column will not have any data.

    2. Statistics gathered in 11g+ with the default estimate_percent, or with a 100% estimate, will return an accurate number for that point in time. But statistics gathered before 11g, or with a custom estimate_percent less than 100%, uses dynamic sampling and may be incorrect. If you gather 99.999% a single row may be missed, which in turn means that the answer you get is incorrect.

    If your table is never updated then it is certainly possible to use ALL_TABLES.NUM_ROWS to find out the number of rows in a table. However, and it’s a big however, if any process inserts or deletes rows from your table it will be at best a good approximation and depending on whether your database gathers statistics automatically could be horribly wrong.

    Generally speaking, it is always better to actually count the number of rows in the table rather then relying on the system tables.

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

Sidebar

Related Questions

MY query looks like this: SELECT COUNT(entryID) FROM table WHERE date >= DATE_SUB(CURDATE(), INTERVAL
I have a table that looks like this: id count 1 100 2 50
My data is tab delimited and looks like this: Name Count Sample Dog .0001
I'm writing a cache-eject method that essentially looks like this: while ( myHashSet.Count >
Ok I have a json coming in that looks like this: {count:xxx, important:[{...}]} All
My database structure looks like this: https://docs.google.com/open?id=0B9ExyO6ktYcOenZ1WlBwdlY2R3c Explanation for some of tables: answer_chk_results -
My current query looks like this: SELECT DISTINCT (member), count( UID ) AS numUID
I have a string that looks like this: count( IF (my_id = 'mykey',value,100)) mykey
Say I have a dataframe source <- data.frame(ID=c(1,2), COUNT=c(3,4)) that looks like this: ID
For example, if the data in one worksheet looks like: UsedRange.Columns.Count is 6 which

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.