The first run of following query takes about 45 seconds and all the next ones only 1 second. Can you please explain what is the reason and how is it possible to make query run faster on the first execute too?
OPEN SYMMETRIC KEY TEST_KEY DECRYPTION BY PASSWORD='password'
SELECT this.ID FROM SeparationFiles this
INNER JOIN BarcodeValues b ON this.FIRST_BARCODE_ID = b.ID
WHERE DecryptByKey(b.ENCRYPTED_VALUE, 0) = 'Peter'
Here is execution plan: