Where conditions, Encryption

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Igor

    Where conditions, Encryption

    1. Are stored procedures WITH ENCRYPTION slower than the ones without
    encryption?

    2. Should i put most restrictive conditions first or last in WHERE? In
    which order does MSSQL execute conditions? Or MSSQL determents what
    would be best and does not bother with the way i sorted conditions?

    for example:
    SELECT *
    FROM [users]
    WHERE
    [user_id] = 1 AND
    [baned] = 0

    Is "[user_id] = 1" or "[baned] = 0" going to be executed first?

  • Dan Guzman

    #2
    Re: Where conditions, Encryption

    1. Are stored procedures WITH ENCRYPTION slower than the ones without
    encryption?
    The execution speed will be identical with or without encryption since the
    compiled plan is used. I also ran a cursory test and found no measurable
    difference compilation speed.
    2. Should i put most restrictive conditions first or last in WHERE? In
    which order does MSSQL execute conditions? Or MSSQL determents what
    would be best and does not bother with the way i sorted conditions?
    The order you specify WHERE clause predicates makes no difference. The SQL
    Server optimizer will rearrange predicates as it deems necessary to maximize
    performance. The biggest query performance gains are realized with indexing
    and sargable expressions that SQL Server can use to generate the most
    efficient plan.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    "Igor" <jerosimic@gmai l.comwrote in message
    news:1178362395 .592943.90460@q 75g2000hsh.goog legroups.com...
    1. Are stored procedures WITH ENCRYPTION slower than the ones without
    encryption?
    >
    2. Should i put most restrictive conditions first or last in WHERE? In
    which order does MSSQL execute conditions? Or MSSQL determents what
    would be best and does not bother with the way i sorted conditions?
    >
    for example:
    SELECT *
    FROM [users]
    WHERE
    [user_id] = 1 AND
    [baned] = 0
    >
    Is "[user_id] = 1" or "[baned] = 0" going to be executed first?
    >

    Comment

    • Igor

      #3
      Re: Where conditions, Encryption


      Dan Guzman wrote:
      Everything as i expected. Thank you for your reply.

      Comment

      Working...