SQLite Forum

Views with UNION ALL
There are many different ways that the query could be run.  The query planner
looks at lots of possibilities and tries to pick the one that will run the
fastest.  Whether or not this runs ViewA once and caches the result or if
it runs ViewA multiple times, is indeterminate.  The answer can vary from one
version of SQLite to the next, from one schema to the next, or between two
consecutive runs of the same query.