Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2008
    Posts
    2

    Unanswered: How the condition using NOT EQUAL operator is passed as parameter to procedure

    Hi

    I m passing parameter like 'sub_bu<>bu' to the procedure named get_data.
    get_data procedure which used to get data from particular table. Also i m created index for the table. The problem here i suppose <>(Not equal) operator which reduce the performance of execution.

    My question here is how to represent <> operator in some other ways and increase the performance using index...

    Thx in advance

    Anitha

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Based on this question:
    http://www.dbforums.com/showthread.php?t=1633194

    I think you need to stop, open Books Online and read all about indexes. The gist is that indexes help (in filtering) in broadly one of three ways.

    1) For singleton seeks - where your clause returns a single value\ very small proportion of the table
    2) For contiguous seeks - where you want a load of contiguous values and the index satisifes the requirements of the query
    3) For nonclustered index scans - where the index covers the requirements of the query and the index scan is cheaper than scanning the table\ clustered index.

    A "not equals to" clause can only really be satisfied by 3. As such, your argument is not SARGable.

    How many rows are there that equal 'bu', how many do not, and how many are null?

    BTW - passing 'sub_bu<>bu' as a parameter would typically be considered really bad practice.

    That should give you some reading and googling to do
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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