joining tables : one a normal one and the other FTS virtual table

3k views Asked by At

is it a good idea to join a normal table with FTS table? I want to know whether it is going to effect the original performance of the FTS table or nor? The query definitely would be using MATCH clause of course.

1

There are 1 answers

0
CL. On BEST ANSWER

When you are joining two tables A and B, SQLite has either to look up matching records from table A in table B, or to look up matching records from table B in table A.

If there is an index on tables A or B that makes these lookups fast, then the join is fast. If there are indexes on both tables, SQLite chooses the one that it estimates is more efficient.

So, to answer your question: a join with an FTS table will be performant if you either

  • join a field to either an FTS field using MATCH, or to the FTS table's rowid, or
  • join an FTS field to some field that is indexed in the other table.

To check this, use EXPLAIN QUERY PLAN.