Skip to Content
0
Former Member
Jun 08, 2009 at 02:56 PM

Change in SELECT by splitting into two

83 Views

Hi Gurus,

I am splitting below selection into two as follows.

SELECT * FROM z_rider_hist INTO TABLE gt_rider_rpt

FOR ALL ENTRIES IN gt_revsed_docs

WHERE ( /bic/zopbel = gt_revsed_docs-/bic/zstbel2 OR

clr_doc_no = gt_revsed_docs-/bic/zstbel ) AND

comp_code = gt_revsed_docs-comp_code.

Above selection taking around 10 hours execution time. z_rider_hist table contains millions of records. /bic/zopbel is part of prmary key and clr_doc_no and comp_code are not.

I am splitting above selection into two SELECTs as follows.

(1)

SELECT * FROM z_rider_hist INTO TABLE gt_rider_rpt

FOR ALL ENTRIES IN gt_revsed_docs

WHERE ( /bic/zopbel = gt_revsed_docs-/bic/zstbel2 AND

comp_code = gt_revsed_docs-comp_code.

(2)

SELECT * FROM z_rider_hist APPENDING TABLE gt_rider_rpt

FOR ALL ENTRIES IN gt_revsed_docs

WHERE clr_doc_no = gt_revsed_docs-/bic/zstbel ) AND

comp_code = gt_revsed_docs-comp_code.

After splitting, creating 2 indexes as follows.

1. /bic/zopbel & comp_code

2. clr_doc_no & comp_code

Splitting is done to avoid the use of OR condition in the first select. Currently it is not choosing any index though we have an index with fields /bic/zopbel, clr_doc_no and comp_code is available.

Pls help me to confirm following things:

1. Both the original and splitted SELECTS are same?

2. Above splitting and indexing will improve performance?

3. Do we have any other option to improve the perofrmance of original SELECT without splitting it?

Thanks in advance..

Saj