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

Thread: Speed

  1. #1
    Join Date
    Apr 2003
    Location
    Hyderabad
    Posts
    40

    Speed

    In the below two queries which is faster
    1.Select * from Test_tbl where test_no between 1 and 5;
    2.Select * from Test_tbl where test_no >= 1 and test_no <= 5;

    here test_no is Number datatype.
    Last edited by bk_raavi; 06-03-2003 at 10:52 AM.

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    I think that the answer will probably be about the same. But whether the queries are fast or slow depend more one the structure of the table and the cardinality of the data.

  3. #3
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    The result set from each query given above is different, how can you compare them for performance?
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  4. #4
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    What *are* you people talking about?

    Check the execution plans. Check the stats. Check the times.

    They are exactly, precisely, perfectly the same.

    It is simply 2 different ways of writing the exact same command in Oracle. Not simply logically-equivalent, but actually the same. Oracle simply translates the first statement to the second one before coming up with a plan.

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

  5. #5
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Originally posted by chrisrlong
    What *are* you people talking about?

    Check the execution plans. Check the stats. Check the times.

    They are exactly, precisely, perfectly the same.

    It is simply 2 different ways of writing the exact same command in Oracle. Not simply logically-equivalent, but actually the same. Oracle simply translates the first statement to the second one before coming up with a plan.

    - Chris
    I would check all of that but I have a job that actually pays. I did tried to point tbk_raavi in the right direction. Actually I did run a quick test and they looked the same. However, if I said they were the same someone would come along and say that somehow they were different.

  6. #6
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Good CYA!!

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

  7. #7
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    That's Cover Yer Arse, BTW, not See(C)Ya.

    Just doing some CYA of my own

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

  8. #8
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Originally posted by chrisrlong
    They are exactly, precisely, perfectly the same.
    they are now, but before bk_raavi edited his post the second SQL read ...

    Select * from Test_tbl where test_no >= 1 and test_no <= 10;
    David Aldridge,
    "The Oracle Sponge"

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

    Oracle ACE

  9. #9
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Originally posted by chrisrlong
    That's Cover Yer Arse, BTW, not See(C)Ya.

    Just doing some CYA of my own

    - Chris
    I should have figured it for the former. I think that might be on my mbo ( mayhem by objective )

  10. #10
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Originally posted by slimdave
    they are now, but before bk_raavi edited his post the second SQL read ...

    Select * from Test_tbl where test_no >= 1 and test_no <= 10;
    Ah, that sneaky little so-and-so

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

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