Re: [sqlite] Equiv stmts, different explain plans

2019-03-06 Thread James K. Lowden
On Tue, 05 Mar 2019 13:58:06 -0700 "Keith Medcalf" wrote: > >The query requests no such thing. SQL makes no request or > >suggestion for how to execute a query. It simply describes a result. > >It's up to the implementation to determine how to produce that > >result. > > You are, of course,

Re: [sqlite] Equiv stmts, different explain plans

2019-03-05 Thread Keith Medcalf
On Tuesday, 5 March, 2019 12:53, James K. Lowden wrote: >On Mon, 04 Mar 2019 20:20:08 -0700> "Keith Medcalf" >wrote: >> In the first query the subselect that creates the list is >> independent. >> In the second query the subselect that creates the list is >> correlated. >Yes, and if it can

Re: [sqlite] Equiv stmts, different explain plans

2019-03-05 Thread James K. Lowden
On Mon, 04 Mar 2019 20:20:08 -0700 "Keith Medcalf" wrote: > In the first query the subselect that creates the list is independent. > In the second query the subselect that creates the list is correlated. Yes, and if it can be shown that the two queries are logically equivalent under relational

Re: [sqlite] Equiv stmts, different explain plans

2019-03-05 Thread Keith Medcalf
On Tuesday, 5 March, 2019 04:09, Simon Slavin wrote: >On 5 Mar 2019, at 2:06am, kk wrote: select * from t1 where c=1 and d in (select d from t2 where c=1); select * from t1 where c=1 and d in (select d from t2 where t2.c=t1.c); >> DRH, many thanks for your reply, I

Re: [sqlite] Equiv stmts, different explain plans

2019-03-05 Thread Simon Slavin
On 5 Mar 2019, at 2:06am, kk wrote: >>> select * from t1 >>>where c=1 and d in (select d from t2 where c=1); >>> select * from t1 >>>where c=1 and d in (select d from t2 where t2.c=t1.c); > DRH, many thanks for your reply, I was expecting same output because I > believe stmts to be

Re: [sqlite] Equiv stmts, different explain plans

2019-03-05 Thread R Smith
On 2019/03/05 4:06 AM, kk wrote: On 05/03/2019 01:33, Richard Hipp wrote: create table t1(c,d); create table t2(c,d); explain select * from t1     where c=1 and d in (select d from t2 where c=1); explain select * from t1     where c=1 and d in (select d from t2 where t2.c=t1.c); DRH, many

Re: [sqlite] Equiv stmts, different explain plans

2019-03-04 Thread Keith Medcalf
o: sqlite-users@mailinglists.sqlite.org >Subject: [sqlite] Equiv stmts, different explain plans > >On another DB I came across 2 stmts, that I think are equivalent, but >generated different explain plans. I request a second opinion - are >these 2 stmts equivalent? If so, why do they gene

Re: [sqlite] Equiv stmts, different explain plans

2019-03-04 Thread kk
On 05/03/2019 01:33, Richard Hipp wrote: On 3/4/19, Kyle wrote: On another DB I came across 2 stmts, that I think are equivalent, but generated different explain plans. I request a second opinion - are these 2 stmts equivalent? If so, why do they generate different explain plans even on

Re: [sqlite] Equiv stmts, different explain plans

2019-03-04 Thread Richard Hipp
On 3/4/19, Kyle wrote: > On another DB I came across 2 stmts, that I think are equivalent, but > generated different explain plans. I request a second opinion - are > these 2 stmts equivalent? If so, why do they generate different explain > plans even on sqlite? The two SELECT statements below

[sqlite] Equiv stmts, different explain plans

2019-03-04 Thread Kyle
On another DB I came across 2 stmts, that I think are equivalent, but generated different explain plans. I request a second opinion - are these 2 stmts equivalent? If so, why do they generate different explain plans even on sqlite? TIA -- create table t1(c,d); create table t2(c,d); explain