DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Counting records in a table

  1. #1
    Join Date
    Jan 2001
    Posts
    138

    Counting records in a table

    How do I count records in a table without doing count(*). This particular table may have in excess of 100 million rows. Is there a quicker way of counting, than count(*)? Thanks.

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    How accurate does your count have to be? If you analyze on a regular basis, you can:
    Code:
    select num_rows from user_Tables where table_name = 'MYTAB';
    Jeff Hunter

  3. #3
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    Assuming you are not using any where criteria for count, If you have analyzed the statitics for the table recently it should show up in the USER_TABLES view as 'NUM_ROWS'
    Reddy,Sam

  4. #4
    Join Date
    Apr 2001
    Posts
    46
    Sometime it's forbidden to analyze even with compute statistics
    because of tuning raison for exemple.

    Or because of your statistics is very old.
    So try to use your indexes.
    Most of time, if you have a big table there is at least 1
    indexe to speed up queries
    So query via your index where there is a column with
    unique or not null constraint

    hope that help you
    yt

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    Export the table, see how many rows are being exported. (of course > /dev/null)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width