DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Best Way to check that table is empty

  1. #11
    Join Date
    Jan 2004
    Posts
    162
    I can't help but notice that line 14 appears to have a small but significant cost. I wonder what happens on that line?

  2. #12
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Quote Originally Posted by padders
    I can't help but notice that line 14 appears to have a small but significant cost. I wonder what happens on that line?
    That small but insignificant cost is the fetch into the explicit cursor.
    But for most systems all three methods are equally valid, IMHO.

  3. #13
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Thanks

    Line 46 (select) is faster than line 30 (select count(*)).
    This is what I expected.

    Tamil

  4. #14
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    I'd still maintain that, in most cases, select count(*) is more efficient in human terms - less coding and somewhat easier to understand when you return to it two years hence - unless you spend half a screen explaining why you need that cursor!
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  5. #15
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    The results prove that they are equal.

    Code:
    use_explicit_cursor returned TRUE!!!
    use_explicit_cursor Time (seconds) 0
    use_select_into returned TRUE!!!
    use_select_into_1 Time (seconds) 0
    use_select_into returned TRUE!!!
    use_select_into_2 Time (seconds) 0
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00

  6. #16
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Elapsed: 00:00:00.00
    Haven't we learned before that elapsed time means nothing? The trace matters.
    Jeff Hunter

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