Reputation: 7557
Been searching the web without success on this.
I want to store the results of a query such that I do not have to re-calculate every single time (some recalculation is permissible). The data set is large.
I have created an aggregated table based on the original data but this is of course bad practice so was investigating other potential options.
I saw SQLite allows Virtual Tables: https://www.sqlite.org/vtab.html as well as Views:https://www.sqlite.org/lang_createview.html
and was getting confused on what the difference between the two is (note: I know what a View is from having used SQL Server).
Upvotes: 6
Views: 4541
Reputation: 391306
A view is defined by accessing a table and doing a projection or selection, in essence cutting out a slice of the original table, either column-wise, row-wise, or both.
A virtual table is provided to SQLite from the program using it. It is not really a "table" in the sense of a table in the database, but instead something that looks like a table and can be used in SQL queries as though it was. Instead it is a pluggable API where the program can plug in something that looks like a table.
Upvotes: 4