Skip to Content
2
Former Member
Jun 13, 2008 at 10:53 AM

Inner Joins vs For All Entries - performance query

4542 Views

Hi All,

I'm a bit confused here... I see lots and lots (and lots...) of postings from people asking how to get data from multiple tables.

To me the immediate answer is to use joins in my select statement to reduce the database load but more and more I see people suggesting FOR ALL ENTRIES is better from a performance perspective.

Now, simple question time, which is more efficient in the real world when doing something like the following:- (this is a basic example but I'm sure you know what I mean.)

Select  *
  into  table lt_sales_data
  from  vbap as vbap
 inner  join vbak as vbak
     on vbak~vbeln eq vbap~vbeln
  where  vbak~vbeln in so_vbeln.

or

Select  *
  into  table lt_vbak_data
  from  vbak
 where  vbeln in so_vbeln.

if lt_vbak_data[] is not initial.
select  *
  into  table lt_vbap_data
  from  vbap
  for all entries in lt_vbak_data
 where  vbeln eq lt_vbak_data-vbeln.
endif.

Basically I want to know whether joins or for all entries is better from a database performance perspective.

I want to know why as well so please don't just post links, random cut and paste answers or one liners. I'm convinced for all entries is slower but am willing to be persuaded otherwise if someone can show me proof.

Thanks,

Gareth.