Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP CDS views - SQL trace

Former Member
0 Likes
2,552

Hi,

We have plans to write ABAP CDS views to standardize business logic/data extraction so that development team can make simple queries on CDS views. So we are writing generic CDS views means without many "WHERE" conditions.

I'm trying to understand how it works and impact on the performance when these CDS views are consumed for any particular Plant or Company code.

Let us  say I have below CDS view called "ZCDSV_TEST"

select * from vbak inner join vbap on vbak.vbeln = vbap.vbeln  { <fields> }.

I would like to understand when it is consumed in 2 ways in terms of performance (SQL)

Select * from ZCDSV_TEST  <<<<  1M records

Select * from ZCDSV_TEST WHERE Vkorg = '0001'  <<<< 25K records.( Does this extract 1M records first and then apply WHERE condition to get to 25K.

Would like to understand these type of technical details. Appreciate your inputs.

Cheers.

Laks

1 ACCEPTED SOLUTION
Read only

chandan_praharaj
Contributor
0 Likes
1,368

Interesting though.

The CDS view works like normal view. It will join first and put filter afterwords, but the SQL optimiser will behave differently when we see PlanViz for different SQL. Better please follow the blog to see few example.

you can use my code I use for performance analysis.

and see the table data.


DELETE FROM explain_plan_table WHERE statement_name = 'Chandan';

EXPLAIN PLAN SET STATEMENT_NAME = 'Chandan' FOR

select top 100 * from MY_SCHEMA.ZTAB;

select * from explain_plan_table WHERE statement_name = 'Chandan';

3 REPLIES 3
Read only

chandan_praharaj
Contributor
0 Likes
1,369

Interesting though.

The CDS view works like normal view. It will join first and put filter afterwords, but the SQL optimiser will behave differently when we see PlanViz for different SQL. Better please follow the blog to see few example.

you can use my code I use for performance analysis.

and see the table data.


DELETE FROM explain_plan_table WHERE statement_name = 'Chandan';

EXPLAIN PLAN SET STATEMENT_NAME = 'Chandan' FOR

select top 100 * from MY_SCHEMA.ZTAB;

select * from explain_plan_table WHERE statement_name = 'Chandan';

Read only

0 Likes
1,368

This blog has got great details that I'm looking for.. Thanks Chandan.

Read only

0 Likes
1,368

kindly mark the answer as helpful, if it helped.