Thanks for the reply Gunter. The reason I added “from Tbl” was so there would be more than 1 step involved. The explains require a fair knowledge of the opcodes for more complex queries so I’m still not totally sure as to the answer to my question.
Assuming I’m reading the explains properly, the explain for select 2+2 from Tbl; suggests it is calculated at every step whereas the explain for Select * from Tbl where Col=2+2; seems to suggest the 2+2 is calculated once and then Tbl is scanned for rows where Col=4 The explain for Select * from Tbl where Col = (select min(OtherCol) from OtherTbl); I’m having problems with. I’m even having problems with explain query plan (shown below) for that one. Scan table Tbl Execute scalar subquery 1 Scan table OtherTbl Why would it scan Tbl first? From: Tom<mailto:tamby...@hotmail.com> Sent: 29 May 2017 11:07 To: tam118118<mailto:tam118...@hotmail.com> Subject: FW: [sqlite] Does prepare do arithmetic? From: Hick Gunter<mailto:h...@scigames.at> Sent: 29 May 2017 08:34 To: 'SQLite mailing list'<mailto:sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] Does prepare do arithmetic? Try for yourself. .mode explain explain select 2 +2; explain select 4; BTW: The "from Tbl" clause will only affect the number of result rows (1 for every row in Tbl). -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von xTom Byars Gesendet: Montag, 29. Mai 2017 09:23 An: sqlite-users@mailinglists.sqlite.org Betreff: [sqlite] Does prepare do arithmetic? Please satisfy a curiosity for me If I prepare Select 2 + 2 from Tbl; Will the prepared code be the same as Select 4 from Tbl; Or is the 2+2 calculated at every step? _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: h...@scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users