SAP ASE optimizes the joining of two encrypted columns by performing cipher text comparisons under certain circumstances.
The joining columns have the same datatype. For cipher text comparisons, char and varchar are considered to be the same datatypes, as are binary and varbinary.
For int and float types, the columns have the same length. For numeric and decimal types, the columns must have the same precision and scale.
The joining columns are encrypted with the same key.
The joining columns are not part of an expression. For example, you cannot perform a cipher text join on a join where t.encr_col1 = s.encr_col1 +1.
The encryption key was created with init_vector and pad set to NULL.
The join operator is ‘=’ or ‘<>’.
The data uses the default sort order.
create encryption key new_cc_key for AES with init_vector NULL create table customer (custid int, creditcard char(16) encrypt with new_cc_key) create table daily_xacts (cust_id int, creditcard char(16) encrypt with new_cc_key, amount money........)
create index cust_cc on customer(creditcard)create index daily_cc on daily_xacts(creditcard)
select sum(d.amount) from daily_xacts d, customer c where d.creditcard = c.creditcard and c.custid = 17936