Re: [sqlite] Query optimizer and recursive common table expressions

2018-01-03 Thread Cezary H. Noweta
Hello, On 2018-01-04 01:53, R Smith wrote: Not to mention that if you wait several years, depending on your processor/compiler, the integer 64 value might wrap around and x<=3 might become true once more, producing rows againĀ  :) Unfortunately, it will be stuck when int becomes double (at

Re: [sqlite] Query optimizer and recursive common table expressions

2018-01-03 Thread R Smith
On 2018/01/04 12:36 AM, Richard Hipp wrote: On 1/3/18, Shane Dev wrote: sqlite> with recursive cnt(x) as (select 1 union all select x+1 from cnt) select * from cnt where x <= 3; [no sqlite> prompt, CPU utilization 25%] I assume sqlite is recursively adding rows to the

Re: [sqlite] Query optimizer and recursive common table expressions

2018-01-03 Thread Richard Hipp
On 1/3/18, Shane Dev wrote: > > sqlite> with recursive cnt(x) as (select 1 union all select x+1 from cnt) > select * from cnt where x <= 3; > [no sqlite> prompt, CPU utilization 25%] > > I assume sqlite is recursively adding rows to the queue without considering > that the

Re: [sqlite] Query optimizer and recursive common table expressions

2018-01-03 Thread Shane Dev
I have just spotted a couple of typos in my email below. The first two common table expressions should have been as follows - with recursive cnt(x) as (select 1 union all select x+1 from cnt limit 3) select * from cnt; with recursive cnt(x) as (select 1 union all select x+1 from cnt) select *

[sqlite] Query optimizer and recursive common table expressions

2018-01-03 Thread Shane Dev
Hi, This simple recursive common table expression returns all integers from 1 to 3 as expected - sqlite> with recursive cnt(x) as (select 1 union all select x+1 from cnt limit 3) select * from cnt where x; x 1 2 3 sqlite> If the LIMIT constraint is moved from the compound SELECT to the