Skip to Content
Nov 18, 2012 at 11:55 PM

Secondary Index creation on CATSDB


Dear Friends,

I have a requirement where I need to fetch the records from CATSDB table where the dates are between ERSDA, LAEDA, APDAT. So I have written the below query:

SELECT * from catsdb into table it_catsdb WHERE

( ersda >= input-mt_field_ops_req-dates-low and ersda <= input-mt_field_ops_req-dates-high ) or

( laeda >= input-mt_field_ops_req-dates-low and laeda <= input-mt_field_ops_req-dates-high ) or

( apdat >= input-mt_field_ops_req-dates-low and apdat <= input-mt_field_ops_req-dates-high ).

The above code is working fine. But when I did the check on Code Inspector I got three errors as Large table CATSDB: No field of a table index in WHERE Condition.

It's clear that none of the three fields are indexed in CATSDB. So with the suggestion from other folks, I have created one Secondary index with the three columns ersda,laeda,apdat. When I did the check with Code Inspector, now I'm getting only two errors. I didn't understand what happened. So I tried to separate three columns as different secondary index, now all the errors are gone. My question here - is this is the correct way of indexing - I mean one column per secondary index?