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
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users