ok, Nearly all the time is spent in a big 'CTE' select.
So maybe this sort of ugly CTE query is not threadable. with f0_k as (SELECT f.rowid as nof2, f.*, p.Dn, p.g1, p.g2, p.w, p.other FROM F0 AS f, Pt AS p WHERE f.Io =p.Io) ,F0_mcalc as (SELECT f.*, p.*, (case when Priority=999 then Cg else Source end) AS Sourcef FROM F0_k AS f, Sor AS p WHERE p.omg in (f.Cg, '') And f.Slic Between Be And En And p.PtGroup In (f.Io,f.g1,f.g2,f.w,f.other,'PL','SO','ST','Not_found') ) ,F0_mcalcmin as (SELECT nof2, min(priority) AS minp FROM F0_mcalc GROUP BY nof2) ,F0_mcalc_final as (SELECT f.*, round(qty*coefficient,3) AS qtyf FROM F0_mcalcmin AS fm inner join F0_mcalc AS f on f.nof2=fm.nof2 and f.priority=fm.minp) select * from F0_mcalc_final ; _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

