Let's assume we have this table
ID | MAIL
1 | no@gmail.com
2 | yes@gmail.com
3 | anything@gmail.com
you get the point... I want to query this table now and I receive as input the MD5 hash of the MAIL column values. So my queries would look like this:
SELECT * FROM TABLE
WHERE HashBytes('MD5', MAIL ) = 'CE42C51D0B63DF9F616CCFB4C3FCF16C'
Now imagine this table is a very big table, thousand of thousand of records. My query becomes really slow. What I want to do now is to add an index, but using MD5. I read it can be done on PostgreSQL using something like this:
CREATE INDEX mail_md5 ON TABLE(DECODE(MD5(MAIL), 'HEX'))
Can I do something similar in SQL Server?
Note: I can't add another column with the hash values :(
Note 2: I know a HASH is an irreversible function, the example for the PostgreSQL index was copied from here