>I have a select statement that I am pretty sure is not being optimized correctly.
>
>I have a table with 200,000 records and when I issue the following select statements they both take the same amount of time.
>
>**************************
>SELECT * FROM SCTTKW WHERE at('APPLE',ttk_keyword) > 0 and at('M',ttk_type) > 0
>***************************
>
>Now, with the statement above I would think would have to go through every record to see if 'APPLE' exists anywhere within the field ttk_keyword.
>
>*********************
>SELECT * FROM SCTTKW WHERE TTK_KEYWORD = 'APPLE' and ttk_type = 'M'
>*********************
>
>I have 10 records within the 200,000 where ttk_keyword is 'APPLE' and ttk_type = 'M'. I have an index set up which is "ttk_keyword+ttk_type".
>
>I would think that this statement should be able to "jump" to the first record that has 'APPLE' and then quit after the last record that has apple. But this statement isn't any faster than the previous one.
>
>Am I doing something wrong?
>
>Thanks,
>Paul
Since your tag is "ttk_keyword+ttk_type", change the SELECT to be
WHERE TTK_KEYWORD+TTK_TYPE='APPLE'+'M'
Be sure that the first part on the right of the "=" sign matches the length of the TTK_KEYWORD field.