Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
SQL Select Question
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement