Count(*) and performance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • orajit
    New Member
    • Nov 2007
    • 75

    Count(*) and performance

    Hi ,

    I am using oracle 10g.
    I have one table say Emp and that contains huge volume of data.
    Now I wanted to select the count(*) from that data .

    It takes long time to retrieve the data from that table .

    Could you please suggest the alternative method for retitriving the count(*) without hampering the performance .


    Thanks in advance .
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    use count function on the column on which there is an index.

    Comment

    • orajit
      New Member
      • Nov 2007
      • 75

      #3
      Ok thanks

      I will use select count(rowid) from emp;

      Is it fine.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        that should work for you.

        Comment

        • jonathan184
          New Member
          • Nov 2006
          • 154

          #5
          try count(1)

          usually this is an efficient way of using the count statement.

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            That won't make any difference if used on version 8i onwards.

            Comment

            • orajit
              New Member
              • Nov 2007
              • 75

              #7
              thanks......... ............... .

              Comment

              Working...