Application Development 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: 

which Inner join will give better performance?

0 Kudos

Hi,

Here i posted two queries one with nested inner join or flat.

out of this two quries which one will give better performance?

<b>1)flat iiner join:</b>

select

a~col1

b~col2

c~col3

from ( table1 as a

INNER JOIN table2 as b on bcol2 = acol1

INNER JOIN tabke3 as c on ccol3 = acol1 )

into corresponding fields of table lt_tab

where

a~col11 = 'AB' AND

b~col22 = 'CD' AND

c~col33 = 'EF'.

<b>2) with nested inner join:</b>

select

a~col1

b~col2

c~col3

from ( ( table1 as a

INNER JOIN table2 as b on bcol2 = acol1 )

INNER JOIN tabke3 as c on ccol3 = acol1 )

into corresponding fields of table lt_tab

where

a~col11 = 'AB' AND

b~col22 = 'CD' AND

c~col33 = 'EF'.

Note: Table1 is index using col11 ( 200,000 enteries )

Table2 ( 50,000 enteries )

Table3 is index using col3 ( 200,000 enteries )

Please explain the reason?

Regards,

Prakash.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Prakash,

I hope both consume same time to execute. But flat inner join will be fast rather than nested inner join. But it is negligable.

If you are using more than 2 table in joins, better to create a view and retrieve the data. It will give effective results.

Regards

Bhupal Reddy

6 REPLIES 6

Former Member
0 Kudos

Hi Prakash,

I hope both consume same time to execute. But flat inner join will be fast rather than nested inner join. But it is negligable.

If you are using more than 2 table in joins, better to create a view and retrieve the data. It will give effective results.

Regards

Bhupal Reddy

0 Kudos

Hi Bhupal Reddy,

why are you saying the first will be faster?can you explain bit more???

Regards,

Prakash.

0 Kudos

Hi Prakash,

Use the statement GET RUN TIME - and determine execution time for these two queries. My opinion is the first one little bit fast rather than second. It is almost same.

Regards

Bhupal Reddy

Former Member
0 Kudos

hi

good

both of the inner join statement are same and the code that you have written ll take the appropriate time to access the data from the database,

thanks

mrutyun^

0 Kudos

Hello

can you explain why this query will take more time?

Regards,

Prakash

Former Member
0 Kudos

hi,

Put eacgh query in separate program along with exact table name and run in se30 and check the performance .youu will find which one is giving better performance after analysis them.

Debjani