4 ms·
Are there materialized views in sqlite?
by zb3 3y ago
Are there materialized views in sqlite?
- stefanos82 3y agoI guess..? :thinking: https://sqlite.org/lang_with.html#materialization_hints https://sqlite.org/lang_with.html#materialization_hints
- zb3 3y agobut it seems it's for CTEs, I was asking aboyt materialized views where their result is physically stored all the time
- fforflo 3y agoNot really. In this context they're a hint to the optimizer to evaluate the CTE result store=materialize it somewhere and use that snapshot when the CTE is queried subsequently. The alternative means the CTE is copy-pasted essentially and them evaluated. The closest one can get to materialized views in SQLite is probably with CREATE TABLE AS. Drop and recreate.
- epompeii 3y agoI think you are totally right! The VIEW itself is not a "materialized" view, but when the (normal) view is instantiated within a single query it is treated as MATERIALIZED because it is used multiple times in the query execution: https://www.sqlite.org/lang_with.html#materialization_hints https://www.sqlite.org/lang_with.html#materialization_hints
- eddd-ddde 3y agoNot like in postgres, but you can do stored computed values.