Optimizing encrypted column search
Posted
by Sung Meister
on Stack Overflow
See other posts from Stack Overflow
or by Sung Meister
Published on 2010-03-22T23:06:32Z
Indexed on
2010/03/22
23:11 UTC
Read the original article
Hit count: 430
I have a table called,tblClient
with an encrypted column called SSN
.
Due to company policy, we encrypted SSN
using a symmetric key (chosen over asymmetric key due to performance reasons) using a password.
Here is a partial LIKE
search on SSN
declare @SSN varchar(11)
set @SSN = '111-22-%'
open symmetric key SSN_KEY decrypt by password = 'secret'
select Client_ID
from tblClient (nolock)
where convert(nvarchar(11), DECRYPTBYKEY(SSN)) like @SSN
close symmetric key SSN_KEY
Before encryption, searching thru 150,000 records took less than 1 second.
but with the mix of decryption, the same search takes around 5 seconds.
What strategy can I apply to try to optimize searching thru encrypted column?
© Stack Overflow or respective owner