SQLite Forum

About virutal table and FTS4
Login
I see `VIRTUAL TABLE` like the following. I don't quite understand how it works. My understanding is that it does not hold the real data. The data are from other tables. But for this specific case how to figure out where the data of each field is from?


~~~
sqlite3 -separator $'\t' getsploit.db 'select * from sqlite_master where type="table";'
table	exploits	exploits	0	CREATE VIRTUAL TABLE exploits USING FTS4(id text, title text, published DATE, description text, sourceData text, vhref text)
table	exploits_content	exploits_content	2	CREATE TABLE 'exploits_content'(docid INTEGER PRIMARY KEY, 'c0id', 'c1title', 'c2published', 'c3description', 'c4sourceData', 'c5vhref')
table	exploits_segments	exploits_segments	3	CREATE TABLE 'exploits_segments'(blockid INTEGER PRIMARY KEY, block BLOB)
table	exploits_segdir	exploits_segdir	4	CREATE TABLE 'exploits_segdir'(level INTEGER,idx INTEGER,start_block INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, idx))
table	exploits_docsize	exploits_docsize	6	CREATE TABLE 'exploits_docsize'(docid INTEGER PRIMARY KEY, size BLOB)
table	exploits_stat	exploits_stat	7	CREATE TABLE 'exploits_stat'(id INTEGER PRIMARY KEY, value BLOB)
~~~

For FTS4, is it just to speed up the search?

So the virtual table could be created by `CREATE VIRTUAL TABLE exploits (id text, title text, published DATE, description text, sourceData text, vhref text)`? The only drawback is the search speed is much slower but the results should be the same whether FTS4 is used or not? Thanks.