Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select Question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00271745
Message ID:
00271761
Views:
20
You need SEPARATE indexes on TTK_Keywork and TTK_Type. When you concatenate 2 fields you have to pad the first value [APPLE] to the same number of spaces as that field's length before you add the Type in the string value.

TTK_KEYWORD = 'APPLE' and ttk_type = 'M' requires separate indexes on each field

TTK_KEYWORD + TTK_TYPE = padr('APPLE', field_width, ' ') + 'M' will work with the concatenated index.

>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
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform