Reputation: 51
I am developing an android application and it uses Sqlite DB for storing and retrieving data. The application has a feature of storing and retrieving text data. I have decided to go with VIRTUAL Table Implementation because of the following benefits
a. Faster Execution
b. Full text search
because my application should be scalable to save large amounts of text data and should be able to search for a particular text quickly. Before starting i have few questions.
Thanks in advance
Upvotes: 0
Views: 2083
Reputation: 180020
An FTS table is not really a table; think of it as an index.
To avoid storing tha same data twice, use an external content table.
FTS tables store all data as text, and do not allow any other index than the built-in full-text index. Furthermore, the documentation says:
FTS tables can be queried efficiently using SELECT statements of two different forms:
- Query by rowid. If the WHERE clause of the SELECT statement contains a sub-clause of the form "rowid = ?", where ? is an SQL expression, FTS is able to retrieve the requested row directly using the equivalent of an SQLite INTEGER PRIMARY KEY index.
- Full-text query. If the WHERE clause of the SELECT statement contains a sub-clause of the form " MATCH ?", FTS is able to use the built-in full-text index to restrict the search to those documents that match the full-text query string specified as the right-hand operand of the MATCH clause.
If neither of these two query strategies can be used, all queries on FTS tables are implemented using a linear scan of the entire table.
So you should never try to store non-text data in an FTS table.
Upvotes: 2