SQLite Forum

Surprising (to me) query performance for combined group-by/count using CTE and unions
In case it's relevant (given recent improvements involving materialized CTEs) I ran all of these tests against SQLite 3.34.1.

Oh I think this is relevant! 3.35 release notes include "The default behavior was formerly NOT MATERIALIZED, but is now changed to MATERIALIZED for CTEs that are used more than once."