‎2009 Apr 21 5:56 AM
Hi Friends,
Can you please help me in improving the performance of the following query:
SELECT SINGLE MAX( policyterm ) startterm INTO (lv_term, lv_cal_date) FROM zu1cd_policyterm WHERE gpart = gv_part GROUP BY startterm.
Thanks and Regards,
Johny
‎2009 Apr 21 9:36 AM
long lists can not be produced with a SELECT SINGLE, there is also nothing to group.
But I guess the SINGLE is a bug
SELECT MAX( policyterm ) startterm
INTO (lv_term, lv_cal_date)
FROM zu1cd_policyterm
WHERE gpart = gv_part
GROUP BY startterm.
How many records are in zu1cd_policyterm ?
Is there an index starting with gpart?
If first answer is 'large' and second 'no' => slow
What is the meaning of gpart? How many different values can it assume?
If many different values then an index makes sense, if you are allowed to create
an index.
Otherwise you must be patient.
Siegfried
‎2009 Apr 21 6:10 AM
Hi,
Do you really need the GROUP BY ? Try doing the processing after fetching records instead of GROUP BY .
Regards,
Deepthi
‎2009 Apr 21 6:51 AM
If you have very large data in table zu1cd_policyterm then GROUP BY will work very slow. Else select data into in interal table and do processing.
‎2009 Apr 21 9:36 AM
long lists can not be produced with a SELECT SINGLE, there is also nothing to group.
But I guess the SINGLE is a bug
SELECT MAX( policyterm ) startterm
INTO (lv_term, lv_cal_date)
FROM zu1cd_policyterm
WHERE gpart = gv_part
GROUP BY startterm.
How many records are in zu1cd_policyterm ?
Is there an index starting with gpart?
If first answer is 'large' and second 'no' => slow
What is the meaning of gpart? How many different values can it assume?
If many different values then an index makes sense, if you are allowed to create
an index.
Otherwise you must be patient.
Siegfried