Optimizing inserts in fragment Table - Problem
Posted in 2000
Hello,
I am experimenting with a JDBC-driven Fulltext-Indexing engine and now I
have the following Problem:
there is a table with my search fragments, like this:
nr fragment
1 ABCD
2 BCD
3 EFGH
4 FGH
Both columns are indexed. The principle Search uses a
select nr from fragments where fragment like 'ABC%'
So there is allway the beginning of a fragment matching and the index
can be used for speedup.
Now I want to insert new Fragments in the index. So I create a insert
table (let's call it it) consisting some new fragments. Maybe this looks
like this:
ABCDE
BC
X
F
Since I know that I only look for the beginning of a fragment, I do not
need to insert "BC" because a "LIKE 'BC%' would match "BCD" as well -
and that is enough for me. Even, if I change the "ABCD"-Fragment to
"ABCDE", I do no longer need the Fragment "ABCD" by analog reason.
So the correct result of the main fragmen table shall be:
1 ABCDE
2 BCD
3 EFGH
4 FGH
5 X
Now my question is: how to implement this in SQL? I use Informix Dynamic
Server 7.23 and Informix JDBC 1.5-JC1 with JDK 1.1. I even have a Syntax
Problem to create a LIKE-Clause which checks if the value in one column
of a table matches the beginning of the value in another column, e.g.
something like:
select nr from fragments,it where fragments.fragment LIKE it.fragment ||'%'
This syntax does not work - the % sign is not interpreted as a wildcard
as I would like.
Any hints?