Rule Definition
For performance reason, if some of the fields are not part of an index, then it is often better to avoid using SELECT DISTINCT.
Remediation
Use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplicate rows.
Violation Code Sample
SELECT DISTINCT cityto FROM spfli
INTO TABLE itab
WHERE carrid = 'LH'
AND cityfrom = 'FRANKFURT'.
Fixed Code Sample
SELECT cityto FROM spfli
INTO TABLE itab
WHERE carrid = 'LH'
AND cityfrom = 'FRANKFURT'.
SORT itab BY cityto.
DELETE ADJACENT DUPLICATES
FROM itab COMPARING cityto.
Reference
http://erpgenie.com
ABAP Syntax performance tuning
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.