dbTalk Databases Forums  

Where conditions, Encryption

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Where conditions, Encryption in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Igor
 
Posts: n/a

Default Where conditions, Encryption - 05-05-2007 , 05:53 AM






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?


Reply With Quote
  #2  
Old   
Dan Guzman
 
Posts: n/a

Default Re: Where conditions, Encryption - 05-05-2007 , 08:59 AM






Quote:
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.

Quote:
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 (AT) gmail (DOT) com> wrote

Quote:
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?



Reply With Quote
  #3  
Old   
Igor
 
Posts: n/a

Default Re: Where conditions, Encryption - 05-05-2007 , 12:53 PM




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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.