dimanche 6 septembre 2015

Sqlite executemany or union select for reduced db writes

I'm trying to reduce the number of writes to a Sqlite database when it comes to inserting multiple rows into a table.

I've found two methods of doing this so far, using a union select statement or using the executemany command in sqlite3.

Does executemany work via a single write?

For reference, please see the following statement I'm using (union select):

INSERT INTO table1
SELECT "hello" AS field1, 15 AS field2, 1262340000 AS timestamp 
UNION SELECT "byebye", 10, 1262340000 
UNION SELECT "hi", 20, 1262340000 
UNION SELECT "boo", 25, 1262340000 

Thank you

Aucun commentaire:

Enregistrer un commentaire