Hi experts,
One of our customers intends to implement a custom table security access based on views (which is also based on what he was using with DB2).
Access authorization rules are based on values in two different tables with around 30 000 rows. The idea is to create a view that retrieves the rows of the table (with a minimum of 10 million rows, much more in the future) that are in the connected user’s functional scope, which is defined by the join of the two previously mentioned tables. The view would look something like:
CREATE TABLE auth_table_1
(
cod_sas char(10),
personid char(10),
cod_col char(20),
daf numeric(19,0),
cod_scope char(12)
);
CREATE TABLE auth_table_2
(
name_col char(20),
cod_col char(20),
schema_n char(20),
table_n char(20),
daf numeric(19,0),
secu_level char(10)
);
CREATE TABLE contracts
(
id_contract char(10),
cod_fed numeric(2,0),
cod_scope char(12)
);
CREATE VIEW contracts_sec AS
(
SELECT * FROM contracts
WHERE cod_scope IN
(
SELECT DISTINCT cod_scope FROM auth_table_1 LEFT JOIN auth_table_2 ON auth_table_1.cod_col = auth_table_2.cod_col
WHERE personid = (SELECT client_os_user_name FROM v_monitor.current_session) AND auth_table_1.daf >=auth_table_2.daf AND table_n='contracts'
)
);
Our main concern is query time, what are performance implications of using such views with joins in this scenario?
Many thanks!
Chaima BERRACHDI