Results 1 to 2 of 2

Thread: easy query efficiency question

  1. #1
    John Guest

    easy query efficiency question

    Hi,

    Could someone confirm that the following query:

    update table set x=1, y=1, z=1 where a = 1 or b = 1 or c = 1 or d = 1

    is more efficient than this query:

    update table set x=1, y=1, z=1 where e <> 1 and f <> 1 and g <> 1

    Thanks!



  2. #2
    Patrick Guest

    easy query efficiency question (reply)

    Hi John,
    Your question is in SQL 6.5 discussion Group.
    In the both case the optimizer decides a &#39;table scan&#39;
    In the first request because of &#34;OR&#34;
    In the second because of &#34;Not =&#34;

    You could look at the optimizer decision by a quick look at the query plan. Even if the request is not started.

    Bye
    Patrick


    ------------
    John at 7/7/01 1:40:56 PM

    Hi,

    Could someone confirm that the following query:

    update table set x=1, y=1, z=1 where a = 1 or b = 1 or c = 1 or d = 1

    is more efficient than this query:

    update table set x=1, y=1, z=1 where e <> 1 and f <> 1 and g <> 1

    Thanks!



Posting Permissions

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