On 15 May 2018, at 11:12pm, Torsten Landschoff <torsten.landsch...@scale.eu> wrote:
> when doing a join like > > select * from base b join derived d using (id) order by d.id > > the query plan is abysmal slower than when using > > select * from base b join derived d using (id) order by b.id > > I would have expected that b.id is basically an alias for d.id as this > is a simple left join. Obvious to a good programmer. Not obvious to SQLite. Your SELECT is selecting from the "base" table, but trying to order by a table JOINed to it. The fact that d.id is always equal to b.id isn't spotted by SQLite. It's a possible enhancement opportunity for SQLite, but the way the query is phrased is counter-intuitive and I doubt many people do it. The processing to spot the opportunity might slow down every JOIN operation SQLite performs, so it might not be the right thing for the average user. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users