This is interesting: Some pragmas take effect during the SQL compilation stage, not the execution stage. This means if using the C-language sqlite3_prepare() <https://www.sqlite.org/c3ref/prepare.html>, sqlite3_step() <https://www.sqlite.org/c3ref/step.html>, sqlite3_finalize() <https://www.sqlite.org/c3ref/finalize.html> API (or similar in a wrapper interface), the pragma may run during the sqlite3_prepare() <https://www.sqlite.org/c3ref/prepare.html> call, not during the sqlite3_step() <https://www.sqlite.org/c3ref/step.html> call as normal SQL statements do. Or the pragma might run during sqlite3_step() just like normal SQL statements. Whether or not the pragma runs during sqlite3_prepare() or sqlite3_step() depends on the pragma and on the specific release of SQLite.
When does the optimize pragma take effect? I suppose any output will still happen after sqlite3_step. RBS On Sat, Aug 26, 2017 at 11:59 PM, Keith Medcalf <kmedc...@dessus.com> wrote: > > select * from pragma_optimize(1); > > the table format of all pragmas is to prepend pragma_ to the pragma name. > > select * from pragma_function_list; > select * from pragma_cache_size; > > etc etc. > > https://sqlite.org/pragma.html > > > --- > The fact that there's a Highway to Hell but only a Stairway to Heaven says > a lot about anticipated traffic volume. > > > >-----Original Message----- > >From: sqlite-users [mailto:sqlite-users- > >boun...@mailinglists.sqlite.org] On Behalf Of Bart Smissaert > >Sent: Saturday, 26 August, 2017 16:38 > >To: SQLite mailing list > >Subject: Re: [sqlite] Output of pragma optimize? > > > >> SELECT * FROM PRAGMA optimize(1); > > > >That doesn't prepare, error at ( > > > >RBS > > > >On Sat, Aug 26, 2017 at 11:03 PM, Simon Slavin <slav...@bigfraud.org> > >wrote: > > > >> > >> > >> On 26 Aug 2017, at 10:58pm, Bart Smissaert > ><bart.smissa...@gmail.com> > >> wrote: > >> > >> > I looked at my application code and that seems OK, but the output > >is a > >> > single null value. > >> > What kind of output should I get? > >> > >> That’s just SQLite returning SQLITE_OK because the command ran > >without > >> problems. > >> > >> You need to execute that PRAGMA command as if it’s a SELECT > >command. It > >> should return a table. If the tools you’re using do not allow > >this, turn > >> the PRAGMA into a SELECT command as follows: > >> > >> SELECT * FROM PRAGMA optimize(1); > >> > >> Simon. > >> _______________________________________________ > >> 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 > > > > _______________________________________________ > 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