[sqlite] Recursive CTE optimization

2015-06-03 Thread Darko Volaric
I think the difficulty here is that the optimizer is oriented toward the "low level" and mainly concerned with choosing indexes, processing order etc (see https://www.sqlite.org/optoverview.html ) and has sort of a narrow view of the task. Approaching it from the other end and breaking down the S

[sqlite] Recursive CTE optimization

2015-05-27 Thread Matthias-Christian Ott
I have the following (simplified and generalized) schema and query: CREATE TABLE nodes ( id INTEGER NOT NULL PRIMARY KEY ); CREATE TABLE edges ( a INTEGER NOT NULL REFERENCES nodes (id), b INTEGER NOT NULL REFERENCES nodes (id), PRIMARY KEY (a, b) ); WITH reachable (a, b) AS ( SELECT a

[sqlite] Recursive CTE optimization

2015-05-27 Thread Richard Hipp
On 5/27/15, Matthias-Christian Ott wrote: > It looks like the optimization can be generalized because you can pull > the selection into the initial select query of the CTE. Is there a > chance that SQLite could perform this optimization in one of the next > releases? > Are you offering to fund t