Solution to get count(*) from Big tables quickly
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Solution to get count(*) from Big tables quickly

  1. #1
    Join Date
    Dec 2001
    Posts
    203

    Solution to get count(*) from Big tables quickly

    Oracle Version: Either 10g OR 11gR2

    Objective: Finding total count(number of records) in each table under any schema.

    Avoiding: trying to avoid count(*) OR referring num_rows in dba_tables (even if stats in on)

    Tools: Either exp OR expdp

    Questions
    (1) Is there any way I could generate an Oracle export log file with number of records per table (exactly like our normal export log) WITHOUT actually exporting data?

    (2) Or is there any suggestion to retrieve total number of records [ count(*)] from big tables quickly?


    Please Note: BTW, I am aware of ESTIMATE_ONLY, but that is not what I am looking for.

    Regards
    Sumit
    sumit

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Other than having a PK or index on a "not null" column plus doing the count(*) in parallel... nothing I can think about.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Dec 2002
    Posts
    60
    If you gather stats with full compute option, you can get number of records from the statistics view.

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,027
    If you only want an estimate, and you keep stats on your schema,
    i would look at num_rows in the dba_tables view.

    Or you could try a ouija board...
    this space intentionally left blank

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