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

Thread: Different count between "select * " and "select count(*) "

  1. #1
    Join Date
    May 2003
    Posts
    46

    Different count between "select * " and "select count(*) "

    I ran this query on a view:

    SELECT * FROM JAM_VIEW; -> returned 2154 rows.

    SELECT COUNT(*) FROM JAM_VIEW; -> returned 171 rows.

    Is it not weird? Any idea how could this is possible?

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    Maybe the records deleted from the base table during the interval which you ran both of your select statements.

    regards
    Hrishy

  3. #3
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Maybe you have a corrupt index that was used for the count(*)
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  4. #4
    Join Date
    Nov 2006
    Location
    Sofia
    Posts
    630
    Could you EXPLAIN PLAN for both and post the plans here? That would give a clue.
    It could be a bug as well.
    Thanks

  5. #5
    Join Date
    Nov 2002
    Location
    Mooresville, NC
    Posts
    349
    Did you execute both of the sql statements from same user id. If no it could be there are 2 tables of same name in different schema.
    http://www.perf-engg.com
    A performance engineering forum

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