searching in virtual table (FTS3) in sqlite

593 views Asked by At

i create a virtual table for seaching text in database .

CREATE VIRTUAL TABLE testtable USING FTS3 (
id INTEGER, -- this field have duplicate values
test1 INTEGER,
test2 INTEGER,
test3 TEXT
)

this is word but when i want to search special id get very slow .
also i can't indexing "id" field and get a error :

virtual tables may not be indexed

want to search like this :

select * from testtable where id = 48880

how to make fastest search for this query, i search fast without FTS .

1

There are 1 answers

0
CL. On BEST ANSWER

On FTS tables, only FTS queries are fast.

The values in the id column are indexed as words, so you have to search for them as words:

SELECT * FROM testtable WHERE id MATCH '48880'