A "temp table" would only be visible in the session that creates it and would not live past the end of the session. Sequences should be persistent...
-----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Nico Williams Gesendet: Freitag, 04. August 2017 21:16 An: Sylvain Pointeau <sylvain.point...@gmail.com> Cc: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: Re: [sqlite] sequencer On Fri, Aug 04, 2017 at 09:09:10PM +0200, Sylvain Pointeau wrote: > I programmed the currval using a temp table, but the performance > dropped slightly > > sqlite> WITH T(i) AS (SELECT (1)i UNION ALL SELECT i+1 FROM T WHERE > i<1000000) INSERT INTO seq_test(seq_num) SELECT seq_nextval('s > eq1') from T; > Run Time: real 25.837 user 23.446950 sys 0.171601 > > I create the temp table only once with the help of a global variable. > I believe it is safe (per session), am I right? In general I would say: pthread_once() (Unix) or InitOnceExecuteOnce() (WIN32). But here, a global in combination with CREATE TEMP TABLE IF NOT EXISTS is probably good enough. _______________________________________________ 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