‎2008 Nov 24 12:38 PM
Moved to correct forum by moderator
HI All,
can i write the querry as below. Is it good for performance issue?
SELECT DISTINCT vkorg spart FROM tvta
INTO TABLE lt_spart
WHERE spart IN spart
AND vkorg IN r_vkorg.
Edited by: Matt on Nov 24, 2008 2:40 PM
‎2008 Nov 24 1:31 PM
Hi
I think DISTINCT is nothing to do with the performance, the difference of using it or not is whether you
want repeat data.
‎2008 Nov 24 12:40 PM
‎2008 Nov 24 12:44 PM
‎2008 Nov 24 12:49 PM
>
> HI All,
>
>
> can i write the querry as below. Is it good for performance issue?
>
> SELECT DISTINCT vkorg spart FROM tvta
> INTO TABLE lt_spart
> WHERE spart IN spart
> AND vkorg IN r_vkorg.
If your TVTA table contains as few entries as ours does (only 6) then the performance of any type of select will be fantastic. Performance is always affected by data quantities. There is nothing wrong with using DISTINCT if that is what you want to do.
‎2008 Nov 24 1:31 PM
Hi
I think DISTINCT is nothing to do with the performance, the difference of using it or not is whether you
want repeat data.
‎2008 Nov 24 1:38 PM
Yes it is correct. Select Distinct will only remove the duplicate entries in your selection if there are any in you dbtable.
Thanks,
Jayant
‎2008 Nov 25 2:08 PM
>
> Yes it is correct. Select Distinct will only remove the duplicate entries in your selection if there are any in you dbtable.
>
> > Jayant
Yes, and to do so in a quick way, the select is "enriched" by the order by clause internally. It might be better to read everything into an internal table, sort this one and then do an delete ... duplictaes.
I would take this into consideration and compare the runtime analysis of both ways. Order by (even implicit ones) can cause a lot of performance issues when done on the table.