classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


Hick Gunter
For batch loading via script, you should limit the number of values per statement (SQLite compiles each statement into memory) and per transaction (SQLite needs to write to disk after a certain number of pages are modified).

For batch loading via program, you can prepare the insert statement for 1 row once and bind the values for ech row to be inserted.

-----Urspr√ľngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Grincheux
Gesendet: Sonntag, 01. September 2019 08:28
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] INSERT vs BEGIN

What is the best ?

INSERT INTO artists (name) VALUES
("Gene Vincent")
("John Lennon")
("Ringo Starr")
("Paul McCartney")
("Moi _ Me");

I want to insert 1 000 000 records.
The other manner tot do is creating a transaction with one insert command by line.
My question is what is the best thing to do ?
Or having a transaction for the first sample?

One must know that I am obliged to use "BEGIN DEFERRED TRANSACTION" because others threads needs to access to tables.

Please help me.


Sent from:
sqlite-users mailing list
[hidden email]

 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
sqlite-users mailing list
[hidden email]