Results 1 to 3 of 3

Thread: IN vs EXISTS

  1. #1
    Join Date
    Nov 2003
    Posts
    3

    Unanswered: IN vs EXISTS

    My DBA has advised me that it is better to use the EXISTS statement
    than the IN statement. He says that it uses less server resources or
    is better handled by the optimiser.

    Does anybody know if this is true?

  2. #2
    Join Date
    Nov 2003
    Posts
    5

    Re: IN vs EXISTS

    Originally posted by saulm
    My DBA has advised me that it is better to use the EXISTS statement
    than the IN statement. He says that it uses less server resources or
    is better handled by the optimiser.

    Does anybody know if this is true?
    Yes it is.

    Difference is :

    EXISTS/NOT EXITS will just checks for the existence of data, unlike IN/NOT IN, where it will go comparision.

  3. #3
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524

    Re: IN vs EXISTS

    ... and EXIST will stop and return TRUE reching the first acceptable row => Perf++

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •