Hi,
I am looking for information on performance implications when a parameterized CDS View is queries using OPENSQL with WHERE Clause. Suppose, if we have a CDS View as
define view Ztest
with parameters p_a : s_type
from ztable1 as t1 join
ztable2 as t2
on t1.f1 = t2.f1
and t2.a = $parameters.p_a {
t1.f1,
t2.f2,
t2.f3,
t1.f4,
t1.f5 // field used to be filtered by select option
}
and if we query this from OPENSQL as follows:
DATA(lv_a) = '0001'.
SELECT f1, f2, f3, f4
FROM Ztest( p_a = @lv_a )
WHERE f5 in s_f5. " Query Q
Now my understanding is that if it were a simple CDS View (i.e. without parameters) I believe the where condition would have been pushed down while creation the execution plan for the query Q. Is it correct? Please correct me if I am wrong here.
But in case of parameterized view, since it is saved as a table function inside the DB, so I believe that this function will be called first when the query Q is executed and once we have the result returned from the table function, WHERE clause will be applied after that. Is my understanding correct here?
I need to know this as I am trying this approach in a couple of my objects and need to understand this. If it is going to be heavy on performance, can you please suggest me what could be the possible other way to achieve this with CDS. I want to keep AMDP as last resort. The reason why I am going with parameterized approach is because I am reusing it. I know that we can't pass select options to the CDS View and that's why I am using in WHERE clause of OPENSQL.
Thanks!