Thread: VARCHAR & INDEXES. Context search. Need help.

VARCHAR & INDEXES. Context search. Need help.

From
Sergey Zeleniy
Date:
Hello All!

I have the following table in my database:

+------------+--------------+
|timecode    | time         |
|description | varchar(250) |
+------------+--------------+

Values of a field "description" looks like "word1 word2 word3...",
"word3 word1 word20...", ...
I need to make queries of the next type:

SELECT <fileds> FROM <table> WHERE description ~* "wordN"

That is get all rows, where the word "wordN" join in string.
But in this case occurs full scan of the table. In the table there are
only ~20000 records, but the search is carried out ~20(!!!) seconds.
It is very long!!! Indexes don't work.
Help me, please, solve this problem!

Thanks.

PS: In the table the records are periodically added...

-- 
With Best Regards, 
Sergio ( Green ).