>>Hello fellow weekend-workers <g>,
>>
>>I am changing a candidate key on many of my tables from a single field to a composite expression (e.g. TBL_ID_FLD + BINTOC(TBL_INT_FLD)). My question is, do I also need to create a regular index on the TBL_ID_FLD in order for Rushmore to find records faster? That is, will Rushmore use the composite index key? (and if so, I can save on not having to create an extra index tag).
>>
>>Thank you in advance for any questions.
>
>
>It depends what is your WHERE clause:
>
>CLEAR
>CREATE CURSOR Test (TBL_ID_FLD C(20),TBL_INT_FLD int)
>INDEX ON TBL_ID_FLD + BINTOC(TBL_INT_FLD) TAG Test
>SYS(3054,12)
>SELECT * FROM Test;
>WHERE TBL_ID_FLD = 'asdasdasda' INTO CURSOR crsTest
>?
>SELECT * FROM Test;
>WHERE TBL_ID_FLD + BINTOC(TBL_INT_FLD) = 'asdasdasda' INTO CURSOR crsTest
>?
>SELECT * FROM Test;
>WHERE TBL_ID_FLD LIKE 'asdasdasda%' INTO CURSOR crsTest
>?
>SELECT * FROM Test;
>WHERE TBL_ID_FLD + BINTOC(TBL_INT_FLD) LIKE 'asdasdasda%' INTO CURSOR crsTest
>INDEX ON TBL_ID_FLD TAG Test
>?
>SELECT * FROM Test;
>WHERE TBL_ID_FLD = 'asdasdasda' INTO CURSOR crsTest
>?
>SELECT * FROM Test;
>WHERE TBL_ID_FLD LIKE 'asdasdasda%' INTO CURSOR crsTest
>SYS(3054,12)
>
Borislav,
Thank you very much for the illustration. I completely forgot about sys(3054) to see Rushmore optimization level.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham