On Sun, Aug 24, 2014 at 3:13 AM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> >  c.execute("INSERT INTO player VALUES
> ('Player%d',%f,NULL)"%(i,random.random()))
>
> >real    5m29.157s
> >user    5m22.137s
> >sys    0m5.457s
>
> Not that it makes much of a difference since this is only for "testing"
> but using:
>
>    c.execute('INSERT INTO player VALUES (?,?,NULL);', ('Player%d' % i,
> random.random()))
>
> is 500% faster....
>


Since we're being pedantic this morning, why not leave Python out all
together and populate the test database in pure SQL:

WITH RECURSIVE
   x(y) AS (VALUES(1) UNION ALL SELECT y+1 FROM x WHERE y<10000000)
INSERT INTO player SELECT printf('Player%d',i), i, random(), NULL FROM x;

;-)



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to